Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import zipfile
|
| 4 |
+
|
| 5 |
+
# Download and extract the models
|
| 6 |
+
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')
|
| 7 |
+
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')
|
| 8 |
+
os.system('rm glow.zip && rm hifi.zip')
|
| 9 |
+
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/')
|
| 10 |
+
|
| 11 |
+
# Define the TTS function
|
| 12 |
+
def run_tts(text, language):
|
| 13 |
+
# Your TTS code here
|
| 14 |
+
|
| 15 |
+
# Replace this placeholder implementation with your actual code
|
| 16 |
+
audio_data = "Base64-encoded-audio-data"
|
| 17 |
+
return audio_data
|
| 18 |
+
|
| 19 |
+
# Define the Gradio interface
|
| 20 |
+
def text_to_speech(text):
|
| 21 |
+
audio_data = run_tts(text, language="mr")
|
| 22 |
+
return audio_data
|
| 23 |
+
|
| 24 |
+
iface = gr.Interface(fn=text_to_speech, inputs="text", outputs="audio")
|
| 25 |
+
iface.launch()
|