Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available: 6.20.0
metadata
title: TTSIE
emoji: 🎙️
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 4.44.0
python_version: '3.10'
app_file: app.py
pinned: false
TTSIE – Text to Speech Synthesis
TTSIE is a text‑to‑speech demo built with Tacotron 2 for mel‑spectrogram prediction and HiFi‑GAN as a neural vocoder, wrapped in a modern Gradio interface for easy experimentation and deployment on Hugging Face Spaces.
1. Project structure (key files)
Imports.py– common library imports (TensorFlow / Keras, JAX, NumPy, librosa, etc.).Configuration.py– core constants (sample rate, FFT length, number of mel bins, etc.).preprocessing.py– text–to–ID mappings and JAX mel computation utilities.Tacotron_V2_Layers.py– Tacotron 2 encoder, decoder, attention and postnet layers.Vocoder_Layers.py– HiFi‑GAN‑style generator definition.Model_Loading.py– builds the encoder, decoder, postnet and vocoder Keras models.Weights_Loading.py– loads the Tacotron 2 model state (tacotron2_state_best.pkl).Inference.py– full inference loop that runs Tacotron 2 + postnet + HiFi‑GAN to produce audio.app.py– Gradio UI for text input and audio output, ready for Hugging Face Spaces.requirements.txt– Python dependencies for local use and Spaces.
- Create and activate a virtual environment (recommended).
- Install dependencies:
pip install -r requirements.txt - Make sure the following weight/state files are placed in this directory:
tacotron2_state_best.pklvocoder_state_best.pkl(If your files use different names, update them inWeights_Loading.pyandapp.py.)
- Launch the Gradio app:
python app.py - Open the printed local URL in your browser and type text into the big textbox, then click Generate to hear the synthesized speech.
3. Deploying to Hugging Face Spaces
- Create a new Space (type: Gradio).
- Upload (or push via Git) at least these files to the root of the Space:
app.pyrequirements.txtImports.py,Configuration.py,preprocessing.pyTacotron_V2_Layers.py,Vocoder_Layers.py,Model_Loading.py,Weights_Loading.py,Inference.py- Model state files:
tacotron2_state_best.pkl,vocoder_state_best.pkl
- Ensure the Space is configured to use
app.pyas the entry point (default for Gradio Spaces). - Once the build finishes, the Space will display the same TTSIE interface shown in the mockup image and allow you to generate speech directly from your browser.
4. Notes
- This project is intended for educational and experimental purposes.
- The code focuses on clarity and end‑to‑end functionality rather than production optimization.
- If you change the architecture or training setup, make sure to update the configuration constants and checkpoint loading paths accordingly.