forked from ggerganov/whisper.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* npm : preparing infra for node package * npm : package infra ready * npm : initial version ready * npm : change name to whisper.cpp whisper.js is taken
- Loading branch information
Showing
15 changed files
with
373 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
if (EMSCRIPTEN) | ||
add_subdirectory(javascript) | ||
|
||
add_custom_command( | ||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/javascript/publish.log | ||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/javascript/whisper.js | ||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/javascript/libwhisper.worker.js | ||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/javascript/package.json | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/javascript | ||
COMMAND npm publish | ||
COMMAND touch publish.log | ||
COMMENT "Publishing npm module v${PROJECT_VERSION}" | ||
VERBATIM | ||
) | ||
|
||
add_custom_target(publish-npm | ||
DEPENDS javascript/publish.log | ||
) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# whisper.cpp | ||
|
||
Node.js package for Whisper speech recognition | ||
|
||
For sample usage check [tests/test-whisper.js](/tests/test-whisper.js) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "whisper.cpp", | ||
"version": "@PROJECT_VERSION@", | ||
"description": "Whisper speech recognition", | ||
"main": "whisper.js", | ||
"scripts": { | ||
"test": "echo \"todo: add tests\" && exit 0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ggerganov/whisper.cpp" | ||
}, | ||
"keywords": [ | ||
"openai", | ||
"whisper", | ||
"speech-to-text", | ||
"speech-recognition", | ||
"transformer" | ||
], | ||
"author": "Georgi Gerganov", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ggerganov/whisper.cpp/issues" | ||
}, | ||
"homepage": "https://github.com/ggerganov/whisper.cpp#readme" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "whisper.cpp", | ||
"version": "1.0.0", | ||
"description": "Whisper speech recognition", | ||
"main": "whisper.js", | ||
"scripts": { | ||
"test": "echo \"todo: add tests\" && exit 0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ggerganov/whisper.cpp" | ||
}, | ||
"keywords": [ | ||
"openai", | ||
"whisper", | ||
"speech-to-text", | ||
"speech-recognition", | ||
"transformer" | ||
], | ||
"author": "Georgi Gerganov", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ggerganov/whisper.cpp/issues" | ||
}, | ||
"homepage": "https://github.com/ggerganov/whisper.cpp#readme" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,47 @@ | ||
# | ||
# libmain | ||
# | ||
|
||
set(TARGET libmain) | ||
|
||
add_executable(${TARGET} | ||
emscripten.cpp | ||
) | ||
|
||
target_link_libraries(${TARGET} PRIVATE | ||
whisper | ||
) | ||
|
||
unset(EXTRA_FLAGS) | ||
|
||
if (WHISPER_WASM_SINGLE_FILE) | ||
set(EXTRA_FLAGS "-s SINGLE_FILE=1") | ||
message(STATUS "Embedding WASM inside main.js") | ||
|
||
add_custom_command( | ||
TARGET ${TARGET} POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy | ||
${CMAKE_BINARY_DIR}/bin/libmain.js | ||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/whisper.wasm/main.js | ||
) | ||
endif() | ||
|
||
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS " \ | ||
--bind \ | ||
-s USE_PTHREADS=1 \ | ||
-s PTHREAD_POOL_SIZE=8 \ | ||
-s INITIAL_MEMORY=1024MB \ | ||
-s TOTAL_MEMORY=1024MB \ | ||
-s FORCE_FILESYSTEM=1 \ | ||
-s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap']\" \ | ||
${EXTRA_FLAGS} \ | ||
") | ||
|
||
# | ||
# whisper.wasm | ||
# | ||
|
||
set(TARGET whisper.wasm) | ||
|
||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/index-tmpl.html ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/index.html @ONLY) | ||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../helpers.js ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/helpers.js @ONLY) | ||
configure_file(${CMAKE_SOURCE_DIR}/bindings/javascript/whisper.js ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/whisper.js COPYONLY) | ||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/index-tmpl.html ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/index.html @ONLY) | ||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../helpers.js ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/helpers.js @ONLY) |
Oops, something went wrong.