studing-audio / README.md
diegosouzacdv's picture
Add optional LFM3-Audio-2B engine (off unless LFM3_ENABLED=1)
845ded6 verified
|
Raw History Blame Contribute Delete
1.44 kB
---
title: Kokoro TTS
emoji: 🗣️
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 6.6.0
app_file: app.py
pinned: false
python_version: "3.11"
---
# Kokoro TTS (and optional LFM3 for comparison)
Kokoro-82M answers on `/` (Gradio) and `POST /tts/stream` (raw PCM16 mono, streamed).
## Optional second engine: LFM3-Audio-2B
Off by default. To compare it with Kokoro in the same Space, set the Space variable
`LFM3_ENABLED=1`. It adds routes with the same contract under `/lfm3/tts`:
- `POST /lfm3/tts/stream`: `{"text", "voice": "female" | "male" | "af_heart"-style, "sample_rate": 16000 | 24000}`;
`speed` is ignored (LFM3 has no speed control).
- `POST /lfm3/tts/bench`: seconds spent synthesizing vs seconds of audio, per piece.
The first call loads the model, so read the second.
- `GET /lfm3/tts/health`.
The ~8 GB model (float32 on CPU) loads on the first LFM3 request, not at start-up, so Kokoro
is unaffected until then. LFM3 and Kokoro share the 2 vCPUs: benchmark them one at a time.
`TTS_API_KEY`, when set, protects both engines' POST routes.
To make the tutor use LFM3, point `KOKORO_HF_SPACE_URL` at `https://<space>.hf.space/lfm3`
(the client appends `/tts/stream`). Compare both with
`python -m scripts.compare_tts_spaces --space kokoro=https://<space>.hf.space --space lfm3=https://<space>.hf.space/lfm3`.
License of the model: LFM Open License v1.0 (commercial use only below US$10M annual revenue).