Spaces:
Running
Running
Serve prebuilt static bundle without HF build step
Browse files
README.md
CHANGED
|
@@ -4,85 +4,9 @@ emoji: 🎙️
|
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: purple
|
| 6 |
sdk: static
|
| 7 |
-
app_build_command: npm run build && cp -r dist/* .
|
| 8 |
app_file: index.html
|
| 9 |
custom_headers:
|
| 10 |
cross-origin-embedder-policy: require-corp
|
| 11 |
cross-origin-opener-policy: same-origin
|
| 12 |
cross-origin-resource-policy: cross-origin
|
| 13 |
---
|
| 14 |
-
|
| 15 |
-
# Browser Voice Agent Demo
|
| 16 |
-
|
| 17 |
-
Browser-first, on-device voice agent demo with Gradio-style camouflage. The app is served locally with Vite during development and built as static assets for public deployment.
|
| 18 |
-
|
| 19 |
-
## Stack
|
| 20 |
-
|
| 21 |
-
- `Vite` for local development, preview, and bundling
|
| 22 |
-
- `Bun` for package management and tests
|
| 23 |
-
- `@mlc-ai/web-llm` for local browser LLM inference
|
| 24 |
-
- `@huggingface/transformers` for local ASR
|
| 25 |
-
- Vendored Pocket TTS browser worker derived from `KevinAHM/pocket-tts-web`
|
| 26 |
-
|
| 27 |
-
## Local Development
|
| 28 |
-
|
| 29 |
-
```bash
|
| 30 |
-
bun install
|
| 31 |
-
bun run dev
|
| 32 |
-
```
|
| 33 |
-
|
| 34 |
-
Then open `http://localhost:3000`.
|
| 35 |
-
|
| 36 |
-
The same dev server now carries the isolation headers, so Pocket can take the threaded path without a separate custom preview server.
|
| 37 |
-
|
| 38 |
-
For a production-like static serve, use:
|
| 39 |
-
|
| 40 |
-
```bash
|
| 41 |
-
bun run preview
|
| 42 |
-
```
|
| 43 |
-
|
| 44 |
-
That serves the built `dist/` output with the same COOP/COEP/CORP headers.
|
| 45 |
-
|
| 46 |
-
## Test
|
| 47 |
-
|
| 48 |
-
```bash
|
| 49 |
-
bun test
|
| 50 |
-
```
|
| 51 |
-
|
| 52 |
-
## Build
|
| 53 |
-
|
| 54 |
-
```bash
|
| 55 |
-
bun run build
|
| 56 |
-
```
|
| 57 |
-
|
| 58 |
-
The production output is emitted to `dist/`.
|
| 59 |
-
|
| 60 |
-
## Pocket TTS Runtime
|
| 61 |
-
|
| 62 |
-
The app now ships a built-in Pocket TTS browser runtime and same-origin model assets:
|
| 63 |
-
|
| 64 |
-
- `src/vendor/pocket-tts/inference-worker.js`
|
| 65 |
-
- `src/vendor/pocket-tts/sentencepiece.js`
|
| 66 |
-
- `src/vendor/pocket-tts/CODE-LICENSE`
|
| 67 |
-
- `src/vendor/pocket-tts/onnx/*`
|
| 68 |
-
- `src/vendor/pocket-tts/tokenizer.model`
|
| 69 |
-
- `src/vendor/pocket-tts/voices.bin`
|
| 70 |
-
- `src/vendor/onnxruntime-web/*`
|
| 71 |
-
|
| 72 |
-
Those files are copied into `dist/` during `bun run build` and served locally from:
|
| 73 |
-
|
| 74 |
-
- `/pocket-tts/inference-worker.js`
|
| 75 |
-
- `/pocket-tts/sentencepiece.js`
|
| 76 |
-
- `/pocket-tts/onnx/*`
|
| 77 |
-
- `/pocket-tts/tokenizer.model`
|
| 78 |
-
- `/pocket-tts/voices.bin`
|
| 79 |
-
- `/onnxruntime-web/*`
|
| 80 |
-
|
| 81 |
-
The vendored worker code is Apache 2.0; its license file is preserved in [src/vendor/pocket-tts/CODE-LICENSE](/home/autark/src/private-voice-agent/src/vendor/pocket-tts/CODE-LICENSE).
|
| 82 |
-
|
| 83 |
-
For best Pocket performance, serve the app with:
|
| 84 |
-
|
| 85 |
-
- `Cross-Origin-Opener-Policy: same-origin`
|
| 86 |
-
- `Cross-Origin-Embedder-Policy: require-corp`
|
| 87 |
-
|
| 88 |
-
Without those headers, the worker still runs, but ONNX Runtime drops back to single-threaded WASM.
|
|
|
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: purple
|
| 6 |
sdk: static
|
|
|
|
| 7 |
app_file: index.html
|
| 8 |
custom_headers:
|
| 9 |
cross-origin-embedder-policy: require-corp
|
| 10 |
cross-origin-opener-policy: same-origin
|
| 11 |
cross-origin-resource-policy: cross-origin
|
| 12 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|