Spaces:
Sleeping
Sleeping
File size: 2,157 Bytes
e2a7a26 aa0272d e2a7a26 aa0272d e2a7a26 aa0272d e2a7a26 1c2eb44 e2a7a26 1c2eb44 e2a7a26 1c2eb44 |
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 68 69 |
---
title: TTS Samples
emoji: π
colorFrom: red
colorTo: red
sdk: docker
app_port: 8501
tags:
- streamlit
pinned: false
short_description: TTS Samples
license: mit
---
# TTS Samples Player (Streamlit)
This Streamlit app lets you play pre-generated TTS WAV samples in a Hugging Face Space.
## Folder structure
- `app.py`: Streamlit application code.
- `requirements.txt`: dependencies.
- `tts_smaples/`: folder containing subfolders per TTS provider, each with `.wav` files.
- Example:
```
tts_smaples/
βββ azure/
β βββ HsiaoChen.wav
β βββ HsiaoYu.wav
β βββ YunJhe.wav
βββ google/
β βββ Sulafat.wav
βββ openai/
β βββ Nova.wav
βββ yating/
βββ Yating.wav
```
## Deployment in Hugging Face Spaces
1. Create a new Space using the **Streamlit** SDK.
2. Commit the repository with:
- `app.py`
- `requirements.txt` (containing `streamlit`)
- `tts_smaples/` folder with your `.wav` samples.
3. HF Spaces will install dependencies and serve the Streamlit app automatically.
4. Open the Space URL; you should see a dropdown to select provider/voice and play the audio.
## Extending
- **Generate TTS on the fly**: add a `st.text_input` or `st.text_area` and a βGenerateβ button; in its callback, run your TTS engine, save to a temp file or return raw bytes, and pass to `st.audio(...)`.
- **Styling/Layout**: use `st.sidebar` for selections, or columns/containers for layout.
- **Additional formats**: you can support `.mp3` or other audio formats; adjust the file extension check and `st.audio` format argument accordingly.
- **Caching**: if generation is expensive, cache results with `@st.cache_data` or `@st.cache_resource`.
- **Large files**: if your WAV files are large, consider their size for client bandwidth; you may offer compressed versions or stream.
---
### 5. Testing locally
Before pushing:
1. Ensure you have Python installed and a virtualenv.
2. `pip install -r requirements.txt`
3. Ensure your `tts_smaples/` folder is in the same directory.
4. Run:
```bash
streamlit run app.py
|