gitre / README.md
kjbytes's picture
feat: add SRT subtitle generation and improve security
cfff3e1
|
Raw
History Blame Contribute Delete
1.54 kB
---
title: Chatterbox TTS API
emoji: πŸ—£οΈ
colorFrom: indigo
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
---
# Chatterbox TTS API
CPU-only FastAPI wrapper around [ResembleAI/chatterbox](https://huggingface.co/ResembleAI/chatterbox) multilingual TTS.
## Setup
Space β†’ Settings β†’ Variables and secrets β†’ add secret `API_KEY`.
## Usage
```bash
curl -X POST https://<user>-<space>.hf.space/tts \
-H "x-api-key: $API_KEY" -H "content-type: application/json" \
-d '{"text": "Hello there", "lang": "en"}'
# {"url": "https://<user>-<space>.hf.space/audio/<uuid>.wav", "lang": "en"}
```
Then `curl -O <url>` β€” the download endpoint is public (unguessable uuid).
Params: `text` (required, ≀1000 chars), `lang` (default `en`), `exaggeration` (0–2), `cfg_weight` (0–1).
Output is 24kHz mono WAV and always carries Resemble's Perth watermark. Defaults suit most
prompts; for more expressive reads the model card suggests `cfg_weight` ~0.3 with
`exaggeration` ~0.7. Caveat: upstream `generate()` hardcodes `max_new_tokens=1000` (~40s of
audio), so text beyond roughly 600-700 chars is silently truncated.
Supported langs: ar, da, de, el, en, es, fi, fr, he, hi, it, ja, ko, ms, nl, no, pl, pt, ru, sv, sw, tr, zh.
## Notes
- First request downloads the model (~1–2 min); CPU synthesis takes roughly 10–40s per sentence. Free Spaces sleep when idle, so the first call after a wake is slow.
- Audio lives on the ephemeral container disk β€” links die on restart. Add S3/Blob upload if you need durable URLs.