Skip to content

Commit

Permalink
wchess : whisper assisted chess (ggerganov#1595)
Browse files Browse the repository at this point in the history
* wchess: whisper assisted chess

* wchess: fix allowed moves in check

* wchess: touchstart, touchend events

* wchess: css, disabled button

* wchess : html touches

* wchess : minor fixes and code style

* wchess : bump encoder context to 1280

* wchess : index.html

* wchess : fix CI warnings

* wchess : add array header

* wchess : build static library

* wchess : display grammar

* wchess : update UX

* wchess : add comment

* wchess : add README

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
  • Loading branch information
fraxy-v and ggerganov committed Dec 14, 2023
1 parent cf6c8e8 commit 1bac96b
Show file tree
Hide file tree
Showing 38 changed files with 4,233 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -770,6 +770,7 @@ Some of the examples are even ported to run in the browser using WebAssembly. Ch
| [bench](examples/bench) | [bench.wasm](examples/bench.wasm) | Benchmark the performance of Whisper on your machine |
| [stream](examples/stream) | [stream.wasm](examples/stream.wasm) | Real-time transcription of raw microphone capture |
| [command](examples/command) | [command.wasm](examples/command.wasm) | Basic voice assistant example for receiving voice commands from the mic |
| [wchess](examples/wchess) | [wchess.wasm](examples/wchess) | Voice-controlled chess |
| [talk](examples/talk) | [talk.wasm](examples/talk.wasm) | Talk with a GPT-2 bot |
| [talk-llama](examples/talk-llama) | | Talk with a LLaMA bot |
| [whisper.objc](examples/whisper.objc) | | iOS mobile application using whisper.cpp |
Expand Down
2 changes: 1 addition & 1 deletion bindings/javascript/whisper.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions examples/CMakeLists.txt
Expand Up @@ -73,3 +73,5 @@ else()
add_subdirectory(talk-llama)
add_subdirectory(lsp)
endif()

add_subdirectory(wchess)
1 change: 1 addition & 0 deletions examples/helpers.js
Expand Up @@ -22,6 +22,7 @@ var printTextarea = (function() {
async function clearCache() {
if (confirm('Are you sure you want to clear the cache?\nAll the models will be downloaded again.')) {
indexedDB.deleteDatabase(dbName);
location.reload();
}
}

Expand Down
9 changes: 9 additions & 0 deletions examples/wchess/CMakeLists.txt
@@ -0,0 +1,9 @@
set(CMAKE_CXX_STANDARD 11)

add_subdirectory(libwchess)

if (EMSCRIPTEN)
add_subdirectory(wchess.wasm)
else()
add_subdirectory(wchess.cmd)
endif()
5 changes: 5 additions & 0 deletions examples/wchess/README.md
@@ -0,0 +1,5 @@
# wchess.wasm

Voice-controlled chess using Whisper + WebAssembly

Online demo: https://whisper.ggerganov.com/wchess/
19 changes: 19 additions & 0 deletions examples/wchess/libwchess/CMakeLists.txt
@@ -0,0 +1,19 @@
add_library(wchess-core STATIC
WChess.cpp
WChess.h
Chessboard.cpp
Chessboard.h
)

target_link_libraries(wchess-core
PUBLIC
whisper
common
)

target_include_directories(wchess-core
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
)

# add_executable(test-chessboard test-chessboard.cpp Chessboard.cpp)

0 comments on commit 1bac96b

Please sign in to comment.