danbev commited on
Commit
603da69
·
unverified ·
1 Parent(s): 0d0eed6

examples : fix nthread parsing in whisper.wasm (#2938)

Browse files

This commit fixes the nthread parsing in the whisper.wasm example when
using the `Threads` slider to change the number of threads to be used.

Currently this results in the following error:
```console
main.js:5597 Uncaught TypeError: Cannot convert "5" to int
at checkAssertions (main.js:5597:21)
at Object.toWireType (main.js:5611:15)
at Object.full_default (eval at new_ (main.js:5292:27), <anonymous>:10:26)
at whisper.wasm/:649:42
```

examples/whisper.wasm/index-tmpl.html CHANGED
@@ -614,7 +614,7 @@
614
  var nthreads = 8;
615
 
616
  function changeThreads(value) {
617
- nthreads = value;
618
  document.getElementById('threads-value').innerHTML = nthreads;
619
  }
620
 
 
614
  var nthreads = 8;
615
 
616
  function changeThreads(value) {
617
+ nthreads = parseInt(value, 10);
618
  document.getElementById('threads-value').innerHTML = nthreads;
619
  }
620