Spaces:
Sleeping
Sleeping
metadata
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
- Example:
Deployment in Hugging Face Spaces
- Create a new Space using the Streamlit SDK.
- Commit the repository with:
app.py
requirements.txt
(containingstreamlit
)tts_smaples/
folder with your.wav
samples.
- HF Spaces will install dependencies and serve the Streamlit app automatically.
- 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
orst.text_area
and a βGenerateβ button; in its callback, run your TTS engine, save to a temp file or return raw bytes, and pass tost.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 andst.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:
- Ensure you have Python installed and a virtualenv.
pip install -r requirements.txt
- Ensure your
tts_smaples/
folder is in the same directory. - Run:
streamlit run app.py