]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
examples : add wchess.wasm to wasm examples build (#3443)
authorDaniel Bevenius <redacted>
Tue, 30 Sep 2025 14:23:01 +0000 (16:23 +0200)
committerGitHub <redacted>
Tue, 30 Sep 2025 14:23:01 +0000 (16:23 +0200)
* examples : add wchess.wasm to wasm examples build

This commit add the wchess.wasm example to the wasm examples that are
deployed to https://ggml.ai/whisper.cpp.

Refs: https://github.com/ggml-org/whisper.cpp/issues/3434#issuecomment-3346980420

.github/workflows/examples-wasm.yml
examples/CMakeLists.txt
examples/bench.wasm/index-tmpl.html
examples/command.wasm/index-tmpl.html
examples/server.py
examples/stream.wasm/index-tmpl.html
examples/wchess/README.md
examples/wchess/wchess.wasm/CMakeLists.txt
examples/wchess/wchess.wasm/index-tmpl.html
examples/whisper.wasm/index-tmpl.html

index 125c106bb67b966acdff484027e0f7f784289b9d..ebbbdfe20ca75e7af3a3b65aa2d75c6e2593840c 100644 (file)
@@ -67,6 +67,12 @@ jobs:
           cp ${build_dir}/stream.wasm/{index.html,stream.js,helpers.js} ${target_dir}
           cp ${build_dir}/libstream.js ${target_dir}
 
+          # wchess.wasm
+          target_dir=staging/wchess.wasm
+          mkdir -p ${target_dir}
+          cp -r ${build_dir}/wchess.wasm/{index.html,css,img,js} ${target_dir}
+          cp ${build_dir}/wchess.wasm.js ${target_dir}
+
           # whisper.wasm (this will be the main example page)
           target_dir=staging
           mkdir -p ${target_dir}
index c37a2e6dda1702cb442b8ca7767dae5e55cf30df..b202ca00b77668b3d9d64be0cf1c6831bca05f83 100644 (file)
@@ -98,6 +98,7 @@ if (EMSCRIPTEN)
     add_subdirectory(stream.wasm)
     add_subdirectory(command.wasm)
     add_subdirectory(bench.wasm)
+    add_subdirectory(wchess)
 elseif(CMAKE_JS_VERSION)
     add_subdirectory(addon.node)
 else()
index 91589c35b3f19cc66803711b9b5752b056051152..3a941747626f9f22142390d9b8c3ac9cfb386548 100644 (file)
@@ -42,6 +42,7 @@
                 <a href="../bench.wasm/">bench</a> |
                 <a href="../stream.wasm">stream</a> |
                 <a href="../command.wasm/">command</a> |
+                <a href="../wchess.wasm/">wchess</a> |
 
             <br><br>
 
index 2221e9340ba8b63a76420a616f279608c7b4d414..b8dabba349b644ef5d7e7c7ddf72f117f7366010 100644 (file)
@@ -42,6 +42,7 @@
                 <a href="../bench.wasm/">bench</a> |
                 <a href="../stream.wasm">stream</a> |
                 <a href="../command.wasm/">command</a> |
+                <a href="../wchess.wasm/">wchess</a> |
 
             <br><br>
 
index 14f677220f368d2874d979dca78c2d05e81d4fe0..e47368d8f68432198235fcb96f1a701b5d16daa7 100644 (file)
@@ -47,7 +47,12 @@ class CustomHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
 
             elif actual_path == '/':
                 self.path = '/whisper.wasm/index.html'
-            elif actual_path.startswith('/bench.wasm/') or actual_path.startswith('/command.wasm/') or actual_path.startswith('/stream.wasm/'):
+            elif any(actual_path.startswith(prefix) for prefix in (
+                '/bench.wasm/',
+                '/command.wasm/',
+                '/stream.wasm/',
+                '/wchess.wasm/'
+            )):
                 # Keep the path as is, just remove the context root
                 self.path = actual_path
             # For all other paths under the context root
index 941f45075c43e9e5b399ae940ebf9ac81cf2a4f9..546d30a5ce47ce33b93eaba3abf982fd4c9fb934 100644 (file)
@@ -42,6 +42,7 @@
                 <a href="../bench.wasm/">bench</a> |
                 <a href="../stream.wasm">stream</a> |
                 <a href="../command.wasm/">command</a> |
+                <a href="../wchess.wasm/">wchess</a> |
 
             <br><br>
 
index 924b8d9a8ab7cf1734d7ec157323de045c4c56f5..d9694a1eb4d4f40344c69d944ee83ecc0292916a 100644 (file)
@@ -2,7 +2,7 @@
 
 Voice-controlled chess using Whisper
 
-Online demo: https://whisper.ggerganov.com/wchess/
+Online demo: https://ggml.ai/whisper.cpp/
 
 https://github.com/ggerganov/whisper.cpp/assets/1991296/c2b2f03c-9684-49f3-8106-357d2d4e67fa
 
index 0d3dd908a1ceebf30a60de4696eefbb2fb04bc14..74689283de02974b483783261b7ed401fa223f83 100644 (file)
@@ -32,11 +32,10 @@ set_target_properties(${TARGET} PROPERTIES LINK_FLAGS " \
     -s INITIAL_MEMORY=1024MB \
     -s TOTAL_MEMORY=1024MB \
     -s FORCE_FILESYSTEM=1 \
-    -s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap', 'HEAPU8']]\" \
+    -s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap', 'HEAPU8']\" \
     ${EXTRA_FLAGS} \
     ")
 
-
 add_custom_command(
         TARGET ${TARGET} POST_BUILD
         COMMAND ${CMAKE_COMMAND} -E copy_directory
index 47452b312cc4c721a38e31511b3af79dd4f30a4e..8f251c20acb8a9be84e4c49d1ec5ab61f4edcd93 100644 (file)
                 <br><br>
 
                 <b>More examples:</b>
-                    <a href="https://whisper.ggerganov.com/">main</a> |
-                    <a href="https://whisper.ggerganov.com/bench">bench</a> |
-                    <a href="https://whisper.ggerganov.com/stream">stream</a> |
-                    <a href="https://whisper.ggerganov.com/command">command</a> |
-                    <a href="https://whisper.ggerganov.com/talk">talk</a> |
+                    <a href="../">main</a> |
+                    <a href="../bench.wasm">bench</a> |
+                    <a href="../stream.wasm">stream</a> |
+                    <a href="../command.wasm">command</a> |
 
                 <br><br>
 
index d5f1be8929c5e5068be32dba62e5c83dd841e35b..0a7e40e317287bf876ea36a83a4f32891568d830 100644 (file)
@@ -52,6 +52,7 @@
                 <a href="bench.wasm/">bench</a> |
                 <a href="stream.wasm">stream</a> |
                 <a href="command.wasm/">command</a> |
+                <a href="wchess.wasm/">wchess</a> |
 
             <hr>