--- title: Tool Generate Text2Speech emoji: 🗣️ colorFrom: blue colorTo: purple sdk: gradio app_file: app.py pinned: false license: apache-2.0 --- # TTS Dataset Generator (VoxCPM2) Batch text-to-speech tool for preparing paired text/audio datasets to train ASR and TTS models — built on [`openbmb/VoxCPM2`](https://huggingface.co/openbmb/VoxCPM2). ## What it does 1. Upload a JSON file shaped like: ```json [ {"id": 1, "text": "សួស្តី! តើថ្ងៃនេះអ្នកសុខសប្បាយជាទេ?"}, {"id": 2, "text": "..."} ] ``` (up to 100 items per batch) 2. Optionally describe a voice (e.g. `a calm young woman, clear and steady voice`) — VoxCPM2's Voice Design applies it consistently across every item. 3. Click **Generate batch**. Progress and per-item status show live in the table. 4. Download the resulting `.zip`: ``` tts_dataset.zip ├── audio/ │ ├── 1.wav │ ├── 2.wav │ └── ... ├── metadata.csv # id, text, filename, status └── metadata.json ``` ## Deploying this Space This runs as a standard **Gradio SDK Space** (not Static / gradio-lite) because VoxCPM2 is a 2B-parameter PyTorch model — it needs real Python + (ideally) GPU execution, which a browser-only static Space cannot provide. Push these three files (`app.py`, `requirements.txt`, `README.md`) to the Space repo: ```bash git clone https://huggingface.co/spaces/phonsobon/Tool_Generate_Text2Speech cd Tool_Generate_Text2Speech cp /path/to/app.py /path/to/requirements.txt /path/to/README.md . git add . git commit -m "Batch TTS dataset generator (VoxCPM2)" git push ``` ## Hardware notes - Running on **free CPU basic**: generation is slow (roughly tens of seconds per sentence for a 2B-param model). Test with the "Limit" field set low (e.g. 5) before running a full batch of 100. - If you later upgrade to **HF PRO** you can switch this Space to **ZeroGPU** hardware in the Space settings for a large speed-up — no code changes needed, just add a `@spaces.GPU` decorator around the generation call. - Khmer is one of VoxCPM2's 30 officially supported languages.