diff --git a/.gitignore b/.gitignore index 803a7bd4..1d575eca 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,10 @@ __pycache__/ !/webui/logs/.gitkeep /webui/third_party/ /webui/llm_api_key.txt +/webui/native/node_modules/ +/webui/native/.svelte-kit/ +/webui/native/dist/* +!/webui/native/dist/index.html # written by the in-UI language picker; per-machine, not a project setting /webui/configs/ui_language.json # personal voice recording — stays local, repo is public diff --git a/CMakeLists.txt b/CMakeLists.txt index d26be649..7e9f0bac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1229,12 +1229,29 @@ if (ENGINE_ENABLE_OPENMP) target_link_libraries(audiocpp_cli PRIVATE OpenMP::OpenMP_CXX) endif() +set(AUDIOCPP_UI_DIST "${CMAKE_CURRENT_SOURCE_DIR}/webui/native/dist/index.html") +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${AUDIOCPP_UI_DIST}") +if (EXISTS "${AUDIOCPP_UI_DIST}") + file(READ "${AUDIOCPP_UI_DIST}" AUDIOCPP_UI_HEX HEX) +else() + string(HEX "
Embedded WebUI assets are unavailable.
" AUDIOCPP_UI_HEX) +endif() +string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," AUDIOCPP_UI_BYTES "${AUDIOCPP_UI_HEX}") +string(REPLACE "," ",\n" AUDIOCPP_UI_BYTES "${AUDIOCPP_UI_BYTES}") +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/app/server/audiocpp_ui_asset.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/generated/audiocpp_ui_asset.h" + @ONLY +) + add_executable(audiocpp_server app/server/main.cpp app/server/config.cpp app/server/http.cpp + app/server/model_installer.cpp app/server/multipart.cpp app/server/runtime.cpp + app/server/ui_assets.cpp app/cli/args.cpp app/cli/request.cpp app/streaming/pcm_source.cpp @@ -1242,6 +1259,7 @@ add_executable(audiocpp_server ) target_link_libraries(audiocpp_server PRIVATE engine_runtime ggml) +target_include_directories(audiocpp_server PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/generated") if (WIN32) target_link_libraries(audiocpp_server PRIVATE ws2_32) endif() @@ -2028,6 +2046,18 @@ if (ENGINE_BUILD_TESTS) if (ENGINE_ENABLE_OPENMP) target_link_libraries(parakeet_parity_dump PRIVATE OpenMP::OpenMP_CXX) endif() + + add_executable(server_model_installer_test + tests/unittests/test_server_model_installer.cpp + app/server/model_installer.cpp + ) + target_include_directories(server_model_installer_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/app/server) + target_link_libraries(server_model_installer_test PRIVATE Threads::Threads) + + add_test( + NAME server_model_installer_test + COMMAND server_model_installer_test + ) endif() if (ENGINE_BUILD_EXAMPLES) diff --git a/README.md b/README.md index 9237a334..dd4b9666 100644 --- a/README.md +++ b/README.md @@ -145,9 +145,24 @@ package notes. ## WebUI  -audio.cpp includes a Gradio WebUI for trying local models from the browser, managing downloads, and running common TTS/ASR/audio workflows without writing CLI commands. +`audiocpp_server` includes an embedded SvelteKit/TypeScript WebUI for running local TTS, cloning, ASR, +generation, conversion, separation, VAD, diarization, and alignment workflows. The production UI is compiled +into the server binary, so using it requires neither Python nor separate frontend files: -The WebUI lives in [webui/](webui/). See [webui/README.md](webui/README.md) for setup, launch commands, and model-download notes. +```bash +audiocpp_server --ui --backend cuda +``` + +Open `http://127.0.0.1:8080`. Starting with `--ui` and no server config enables on-demand model +load/unload and temporary browser uploads. Existing static server configurations also expose the UI by default; +add `--ui-management` when that instance should permit model switching. + +The native UI also exposes background model download/preparation, long-text split-and-merge synthesis, a +browser-local saved voice library, microphone recording, and near-live ASR input. Some model preparation jobs invoke +the repository's Python model manager because those packages require Hugging Face download or checkpoint conversion; +model inference and the embedded UI remain Python-free. The previous Python/Gradio interface remains available for +compatibility. See [webui/README.md](webui/README.md) for native and legacy launch commands, model notes, and frontend +development instructions. Huge thanks to [@kigner](https://github.com/kigner) for the original [audio.cpp-webui](https://github.com/kigner/audio.cpp-webui), and to [@patrickjchen](https://github.com/patrickjchen) for porting and integrating it into audio.cpp. diff --git a/app/server/audiocpp_ui_asset.h.in b/app/server/audiocpp_ui_asset.h.in new file mode 100644 index 00000000..5bf252ac --- /dev/null +++ b/app/server/audiocpp_ui_asset.h.in @@ -0,0 +1,12 @@ +#pragma once + +#include