Skip to content

Commit

Permalink
Fix error with test CSV on web
Browse files Browse the repository at this point in the history
  • Loading branch information
jpohhhh committed Oct 22, 2024
1 parent c5c2a7f commit 446510e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion example/web/magika_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ self.onmessage = async e => {
return;
}

const float32Array = fileBytes instanceof Float32Array
? fileBytes
: new Float32Array(fileBytes);

console.log('Magika running inference');
const bytesTensor = new ort.Tensor('float32', fileBytes, [1, fileBytes.length]);
const bytesTensor = new ort.Tensor('float32', float32Array, [1, float32Array.length]);
const results = await session.run({ bytes: bytesTensor });
const targetLabel = results['target_label'].data;
const message = { messageId, action: 'inferenceResult', targetLabel };
Expand Down

0 comments on commit 446510e

Please sign in to comment.