File size: 2,207 Bytes
5bca934
 
be6318c
5bca934
be6318c
 
 
5bca934
 
 
 
be6318c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
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.