Download app.py from siya02/tts: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/spaces/siya02/tts/resolve/main/app.py
- Command line
-
hf download hf://spaces/siya02/tts/app.py
-
curl -L -o app.py https://huggingface.co/spaces/siya02/tts/resolve/main/app.py
1.06 kB
| import os | |
| import gradio as gr | |
| import zipfile | |
| # Download and extract the models | |
| os.system('wget -q https://storage.googleapis.com/vakyansh-open-models/tts/marathi/mr-IN/female_voice_0/glow.zip && unzip -q glow.zip -d ttsv/checkpoints/female') | |
| os.system('wget -q https://storage.googleapis.com/vakyansh-open-models/tts/marathi/mr-IN/female_voice_0/hifi.zip && unzip -q hifi.zip -d ttsv/checkpoints/female') | |
| os.system('rm glow.zip && rm hifi.zip') | |
| os.system('wget -q https://storage.googleapis.com/vakyansh-open-models/translit_models.zip -P ttsv/checkpoints/ && unzip -q ttsv/checkpoints/translit_models.zip -d ttsv/checkpoints/') | |
| # Define the TTS function | |
| def run_tts(text, language): | |
| # Your TTS code here | |
| # Replace this placeholder implementation with your actual code | |
| audio_data = "Base64-encoded-audio-data" | |
| return audio_data | |
| # Define the Gradio interface | |
| def text_to_speech(text): | |
| audio_data = run_tts(text, language="mr") | |
| return audio_data | |
| iface = gr.Interface(fn=text_to_speech, inputs="text", outputs="audio") | |
| iface.launch() | |