Hermes Bot commited on
fix(tinybard): add background pre-warming of Kokoro TTS on server startup
Browse files
.agents/tasks/TASK.2026-06-10_prewarm.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Task: TinyBard Startup Pre-warming of TTS Models
|
| 2 |
+
|
| 3 |
+
- Branch: fix/tinybard-startup-prewarm
|
| 4 |
+
- Date: 2026-06-10
|
| 5 |
+
|
| 6 |
+
## Chain-of-Draft
|
| 7 |
+
|
| 8 |
+
1. Initialize task file.
|
| 9 |
+
2. Add background thread prewarm.
|
| 10 |
+
3. Merge and push.
|
| 11 |
+
4. Verify on HF Space.
|
| 12 |
+
|
| 13 |
+
####
|
| 14 |
+
Proceeding with implementation.
|
projects/tinybard/app.py
CHANGED
|
@@ -1514,6 +1514,11 @@ mount_gradio_app(fastapi_app, gradio_blocks, path="/gradio")
|
|
| 1514 |
# Entrypoint
|
| 1515 |
# ---------------------------------------------------------------------------
|
| 1516 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1517 |
# On HF Spaces, the platform handles the server — just launch Gradio
|
| 1518 |
if os.environ.get("SPACE_ID"):
|
| 1519 |
log.info("Running on HF Spaces — launching Gradio directly")
|
|
|
|
| 1514 |
# Entrypoint
|
| 1515 |
# ---------------------------------------------------------------------------
|
| 1516 |
if __name__ == "__main__":
|
| 1517 |
+
# Pre-warm Kokoro TTS in a background thread to cache models on startup
|
| 1518 |
+
import threading
|
| 1519 |
+
log.info("Pre-warming Kokoro TTS client in the background...")
|
| 1520 |
+
threading.Thread(target=get_kokoro_client, daemon=True).start()
|
| 1521 |
+
|
| 1522 |
# On HF Spaces, the platform handles the server — just launch Gradio
|
| 1523 |
if os.environ.get("SPACE_ID"):
|
| 1524 |
log.info("Running on HF Spaces — launching Gradio directly")
|