File size: 1,064 Bytes
f7daa49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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()