From: Daniel Bevenius Date: Mon, 24 Mar 2025 13:40:00 +0000 (+0100) Subject: examples : fix nthread parsing in whisper.wasm (#2938) X-Git-Tag: upstream/1.7.5~114 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=ee6286c35dbab30c48b5b7c43197e0f2a25b8372;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp examples : fix nthread parsing in whisper.wasm (#2938) 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), :10:26) at whisper.wasm/:649:42 ``` --- diff --git a/examples/whisper.wasm/index-tmpl.html b/examples/whisper.wasm/index-tmpl.html index 711df3f3..9362d44c 100644 --- a/examples/whisper.wasm/index-tmpl.html +++ b/examples/whisper.wasm/index-tmpl.html @@ -614,7 +614,7 @@ var nthreads = 8; function changeThreads(value) { - nthreads = value; + nthreads = parseInt(value, 10); document.getElementById('threads-value').innerHTML = nthreads; }