]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
examples : fix nthread parsing in whisper.wasm (#2938)
authorDaniel Bevenius <redacted>
Mon, 24 Mar 2025 13:40:00 +0000 (14:40 +0100)
committerGitHub <redacted>
Mon, 24 Mar 2025 13:40:00 +0000 (14:40 +0100)
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

index 711df3f3e5b1a82eff797f6a2cb3aa600341a408..9362d44c57b83c3ccff7a18c1d1031a51cdcd512 100644 (file)
             var nthreads = 8;
 
             function changeThreads(value) {
-                nthreads = value;
+                nthreads = parseInt(value, 10);
                 document.getElementById('threads-value').innerHTML = nthreads;
             }