Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .gitignore +12 -0
- README.md +106 -7
- packages.txt +1 -0
- requirements.txt +5 -0
.gitignore
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.pyc
|
| 3 |
+
.venv/
|
| 4 |
+
venv/
|
| 5 |
+
env/
|
| 6 |
+
output/
|
| 7 |
+
hf_dataset/
|
| 8 |
+
*.zip
|
| 9 |
+
*.wav
|
| 10 |
+
piper_voices/
|
| 11 |
+
.DS_Store
|
| 12 |
+
.gradio/
|
README.md
CHANGED
|
@@ -1,13 +1,112 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
python_version: '3.13'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: "WakeForge: GCP & Piper TTS Wake Word Dataset Creator"
|
| 3 |
+
emoji: π¨
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.0
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
license: cc-by-4.0
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# π¨ WakeForge
|
| 14 |
+
### GCP & Piper TTS Wake Word Dataset Creator
|
| 15 |
+
|
| 16 |
+
A Hugging Face Space that generates a synthetic **keyword-spotting / wake-word**
|
| 17 |
+
dataset ready for **Hugging Face Datasets** and **Edge Impulse**.
|
| 18 |
+
|
| 19 |
+
It uses **Google Cloud Text-to-Speech** when you provide an API key, and
|
| 20 |
+
**automatically falls back to free, local Piper TTS** when you don't β so it
|
| 21 |
+
always works, with or without a paid service.
|
| 22 |
+
|
| 23 |
+
## Features
|
| 24 |
+
|
| 25 |
+
- π **Automatic backend selection** β Google Cloud TTS (API key) with a free
|
| 26 |
+
Piper TTS fallback.
|
| 27 |
+
- π§± **Three keyword-spotting classes** β `hey_android`, `unknown`,
|
| 28 |
+
`background_noise` (fully configurable phrases and labels).
|
| 29 |
+
- ποΈ **Local augmentation** β gain, time shift, additive noise, echo, plus
|
| 30 |
+
synthetic background-noise generation.
|
| 31 |
+
- π¦ **Edge Impulse-ready** β `label.<id>.wav` filenames and `training` /
|
| 32 |
+
`testing` folders.
|
| 33 |
+
- β¬οΈ **One-click publishing** β push to a Hugging Face dataset repo and/or
|
| 34 |
+
**upload directly to your Edge Impulse project** with your own API key.
|
| 35 |
+
|
| 36 |
+
## Using the Space
|
| 37 |
+
|
| 38 |
+
1. Set the phrases, labels and dataset size.
|
| 39 |
+
2. *(Optional)* Paste a **Google Cloud TTS API key**. Leave blank to use free
|
| 40 |
+
Piper TTS.
|
| 41 |
+
3. *(Optional)* Tick **Push to Hugging Face** and provide a repo id + write token.
|
| 42 |
+
4. *(Optional)* Tick **Upload to Edge Impulse** and paste your project API key
|
| 43 |
+
(Edge Impulse β your project β **Dashboard β Keys**).
|
| 44 |
+
5. Click **Generate dataset** and download the resulting zip.
|
| 45 |
+
|
| 46 |
+
### Space secrets (optional)
|
| 47 |
+
|
| 48 |
+
Instead of typing keys into the UI, set them as Space secrets:
|
| 49 |
+
|
| 50 |
+
| Secret | Purpose |
|
| 51 |
+
|---|---|
|
| 52 |
+
| `GCP_TTS_API_KEY` | Google Cloud TTS API key |
|
| 53 |
+
| `HF_TOKEN` | Hugging Face write token for pushing datasets |
|
| 54 |
+
| `EDGE_IMPULSE_API_KEY` | Edge Impulse project API key |
|
| 55 |
+
|
| 56 |
+
## Command line
|
| 57 |
+
|
| 58 |
+
The same pipeline runs locally without Gradio:
|
| 59 |
+
|
| 60 |
+
```bash
|
| 61 |
+
pip install -r requirements.txt
|
| 62 |
+
|
| 63 |
+
# Free Piper TTS, prepare an HF folder locally
|
| 64 |
+
python generate.py --out output --hf-out hf_dataset
|
| 65 |
+
|
| 66 |
+
# Google Cloud TTS + push to HF + upload to Edge Impulse
|
| 67 |
+
python generate.py \
|
| 68 |
+
--gcp-api-key "$GCP_TTS_API_KEY" \
|
| 69 |
+
--push-hf-repo "username/hey-android" --hf-token "$HF_TOKEN" \
|
| 70 |
+
--edge-impulse-api-key "$EDGE_IMPULSE_API_KEY"
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
## Output layout
|
| 74 |
+
|
| 75 |
+
```text
|
| 76 |
+
output/
|
| 77 |
+
edge_impulse_upload/
|
| 78 |
+
training/ hey_android.<id>.wav ...
|
| 79 |
+
testing/ hey_android.<id>.wav ...
|
| 80 |
+
by_label/
|
| 81 |
+
hey_android/ ...
|
| 82 |
+
metadata.csv
|
| 83 |
+
selected_voices.csv
|
| 84 |
+
dataset_summary.json
|
| 85 |
+
|
| 86 |
+
hf_dataset/
|
| 87 |
+
audio/train/ ...
|
| 88 |
+
audio/test/ ...
|
| 89 |
+
README.md # dataset card
|
| 90 |
+
hf_metadata.csv
|
| 91 |
+
metadata.csv
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
## Getting the keys
|
| 95 |
+
|
| 96 |
+
- **Google Cloud TTS API key** β [Google Cloud Console](https://console.cloud.google.com/):
|
| 97 |
+
enable *Cloud Text-to-Speech API*, then **APIs & Services β Credentials β
|
| 98 |
+
Create credentials β API key**.
|
| 99 |
+
- **Edge Impulse API key** β your project β **Dashboard β Keys**.
|
| 100 |
+
- **Hugging Face token** β [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens)
|
| 101 |
+
(needs *write* access).
|
| 102 |
+
|
| 103 |
+
## Notes & limitations
|
| 104 |
+
|
| 105 |
+
Synthetic TTS audio is great for **bootstrapping** a wake-word model but is not
|
| 106 |
+
a production benchmark. Before deploying, add real recordings from the target
|
| 107 |
+
device and expected acoustic environments.
|
| 108 |
+
|
| 109 |
+
## License
|
| 110 |
+
|
| 111 |
+
CC BY 4.0. Verify that your use of generated synthetic speech complies with the
|
| 112 |
+
terms of the voice models (Google Cloud TTS / Piper voices) you use.
|
packages.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
espeak-ng
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio>=4.44.0
|
| 2 |
+
numpy>=1.24
|
| 3 |
+
requests>=2.31
|
| 4 |
+
huggingface_hub>=0.24
|
| 5 |
+
piper-tts>=1.2.0
|