Skip to content

WebUI - Initial native Svelte WebUI embedded inside audiocpp_server.exe — no Python, Node.js, or Gradio needed - #185

Draft
mirek190 wants to merge 4 commits into
0xShug0:mainfrom
mirek190:agent/native-svelte-webui
Draft

WebUI - Initial native Svelte WebUI embedded inside audiocpp_server.exe — no Python, Node.js, or Gradio needed#185
mirek190 wants to merge 4 commits into
0xShug0:mainfrom
mirek190:agent/native-svelte-webui

Conversation

@mirek190

@mirek190 mirek190 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Screenshot 2026-08-04 082608

This introduces the initial native SvelteKit/TypeScript WebUI and embeds its complete static output inside audiocpp_server.exe.

Normal browser inference now needs only the server executable plus the selected CPU/GPU runtime libraries. Python, Node.js, and Gradio are not runtime dependencies:

Browser
   |
   | HTTP on localhost
   v
audiocpp_server.exe
   |-- compiled-in Svelte HTML/CSS/JavaScript
   |-- native /v1 server APIs
   `-- audio.cpp model sessions
          |-- CPU
          `-- CUDA / other configured backends

Node.js is used only when a developer rebuilds the frontend artifact. Python is used only when the user explicitly asks the optional model installer to download or convert a package; loading a prepared model and running inference remain native. The existing Gradio UI is retained as a compatibility option but is not used by this UI.

What is included

  • Build webui/native as a single static document and convert it to a generated C++ byte array during CMake configuration.
  • Serve the compiled asset at / and /index.html, with cache, CSP, and content-type safety headers.
  • Add server switches --ui, --no-ui, and --ui-management; --ui can start a model-management host without an external server JSON file.
  • Add guarded native endpoints for dynamic model loading/unloading, path checks, temporary uploads, and asynchronous package-install status.
  • Cover the primary audio.cpp workflows:
    • text to speech and voice cloning
    • ASR/transcription and near-live ASR
    • music generation
    • voice conversion
    • source separation, including HTDemucs, BS-RoFormer, and Mel-Band RoFormer presets
    • audio analysis
    • voice design
  • Add long-text splitting/merge, microphone capture, multiple-output playback, timing, model catalog/settings, and a browser-local IndexedDB voice library.
  • Route package-spec installs through model_manager_v2.py; keep converter-input packages on the deprecated helper until those packages migrate.
  • Extend portable Windows packaging with the optional model-management resources.
  • Document native and legacy WebUI setup and add focused configuration/model-installer tests.

Build and test commands

Frontend:

cd webui/native
npm ci
npm run check
npm run build

CPU server and tests:

cmake --build build/native-ui-cpu --config Release --target audiocpp_server server_config_test server_model_installer_test --parallel 8
ctest --test-dir build/native-ui-cpu -C Release --output-on-failure -R "server_(config|model_installer)_test"

CUDA server (RTX 3090 / compute capability 8.6, CUDA 12.4):

.\scripts\build_windows.ps1 -Preset windows-cuda-release -Target audiocpp_server -CudaArchitectures 86 -Jobs 8

Run the native UI:

.\build\windows-cuda-release\bin\audiocpp_server.exe --ui --backend cuda --host 127.0.0.1 --port 18991

Then open http://127.0.0.1:18991/.

Results

  • svelte-check: 0 errors, 0 warnings.
  • Frontend static build: passed.
  • CPU audiocpp_server: built successfully against current main (238ab6a).
  • server_config_test: passed.
  • server_model_installer_test: passed.
  • CUDA audiocpp_server: built successfully with CUDA 12.4 for SM 8.6.
  • CUDA smoke test:
    • GET /health: status=ok, backend=cuda, ui=true, ui_management=true
    • GET /: HTTP 200, 167,097 bytes
    • embedded page contained the current BS-RoFormer catalog entry

Generated artifacts:

  • webui/native/dist/index.html
  • build/native-ui-cpu/bin/Release/audiocpp_server.exe
  • build/windows-cuda-release/bin/audiocpp_server.exe

Known limitations

  • Model download/conversion from the WebUI is optional and still invokes the repository Python model-manager helper. Users with already prepared models do not need Python.
  • The legacy Gradio interface remains in the repository for advanced Python-assisted or compatibility workflows; it is separate from the embedded native UI.
  • Near-live ASR uses repeated server requests rather than a browser-side model runtime.

Build the SvelteKit/TypeScript frontend as one static HTML artifact and convert it to a generated C++ byte array at CMake configure time. audiocpp_server serves that compiled asset at /, so normal UI and inference use require only the server binary and its selected backend libraries; Node.js is a frontend build dependency, not a runtime dependency, and Gradio is not involved.

Cover TTS and voice cloning, ASR and near-live transcription, music generation, voice conversion, source separation, audio analysis, and voice design. Add reusable browser audio handling, long-text splitting and merge, microphone capture, an IndexedDB voice library, model catalog and settings, generic task results, timing, and multiple-output playback.

Add --ui, --no-ui, and --ui-management server controls plus guarded APIs for dynamic model load/unload, path inspection, uploads, and asynchronous package installation. Pure UI inference remains Python-free; optional model download or legacy conversion delegates to the packaged Python model-manager helpers when requested.

Teach portable Windows packaging to include the optional model-management resources, document native and legacy WebUI operation, and add focused configuration and installer tests. Verified Svelte checks/build, CPU server build/tests, and embedded UI smoke tests on CPU and CUDA.
@0xShug0

0xShug0 commented Aug 4, 2026

Copy link
Copy Markdown
Owner

The UI looks super cool!

@mirek190

mirek190 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Pushed commit 684832b with the current native WebUI model-library update.

What changed

  • Added asynchronous model-package installation with live byte and percentage progress in the embedded UI.
  • Exposed GGUF Q8, GGUF BF16/FP16, and Safetensors choices with their package-specific download sizes and availability state.
  • Detects already-installed package variants using their declared files, disables the corresponding button, and shows Already downloaded.
  • Allows precision variants that share a package directory to coexist without treating the directory itself as a conflict.
  • Added per-variant trash controls and a server uninstall endpoint. Removal deletes only files declared by that package and preserves sibling variants and unrelated files.
  • Corrected Pocket TTS package paths and its gated Safetensors messaging.
  • Made model cards, Open controls, and package-choice rows consistent in size; same-row cards now align with uniform vertical gaps.
  • Updated the embedded production WebUI artifact and documentation.

Validation

  • npm --prefix webui/native run check ? 0 errors, 0 warnings
  • python -m unittest webui.test_model_manager_webui ? 16 tests passed
  • server_model_installer_test ? passed
  • CPU audiocpp_server Release build ? passed
  • CUDA audiocpp_server Release build ? passed
  • Browser layout check ? matching card heights within each row and consistent 12 px row gaps

@mirek190

mirek190 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Pushed follow-up commit 55f495a

Root cause

All ModelInstaller instances used the same %TEMP%/audiocpp-model-installer directory and reused names such as package-sizes-1.json. A test process or second server could overwrite the live server's inventory snapshot. The UI would then lose the real installed-package records and leave an existing package clickable.

Fix

  • Give every installer/server instance a unique temporary job directory.
  • Remove that private directory when its installer state is released after normal shutdown.
  • Treat a package whose complete declared file set already exists as an idempotent successful install.
  • Continue rejecting genuinely partial packages unless --overwrite is requested.
  • Add regression coverage proving two installer instances cannot overwrite each other's inventory output.

Validation

  • Python model-manager suite: 17 tests passed.
  • C++ server_model_installer_test: passed, including cross-instance isolation.
  • CPU and CUDA Release server builds: passed.
  • Live CUDA inventory: 127 packages returned; Pocket English Q8 and BF16 both reported installed: true.
  • Exact Pocket Q8 install API request against the existing file: completed with exit code 0 and already installed, with no download or overwrite.

@mirek190

mirek190 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Pushed follow-up commit 0fe5bca fixing installed-package precision selection and stale inventory after downloads.

Changes

  • Installed Q8/BF16/FP16/Safetensors buttons remain enabled and now select the model variant instead of trying to download it again.
  • Buttons retain the format label and distinguish Selected ? size from Downloaded ? size.
  • Open uses the selected installed package path.
  • A successful install invalidates the server's cached package inventory.
  • The frontend refreshes that inventory once for each newly completed install, so Studio ? Models navigation cannot restore stale installed flags.
  • Added server regression coverage for inventory invalidation after a successful preparation.

Validation

  • Svelte check: 0 errors and 0 warnings.
  • C++ server_model_installer_test: passed.
  • CPU and CUDA Release server builds: passed.
  • Browser test with Pocket TTS:
    • Q8 and BF16 both remained marked downloaded.
    • Switched Q8 ? BF16, navigated Models ? Studio ? Models, and BF16 remained selected.
    • Switched back to Q8 and pressed Open.
    • Studio resolved models/PocketTTS-GGUF/english/pocket-tts-english-q8_0.gguf.

@mirek190 mirek190 changed the title Initial native Svelte WebUI is embedded inside audiocpp_server.exe — no Python, Node.js, or Gradio needed WebUI - Initial native Svelte WebUI embedded inside audiocpp_server.exe — no Python, Node.js, or Gradio needed Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants