File size: 614 Bytes
d5720d9
2e681b7
 
88d9212
 
2e681b7
 
 
 
88d9212
 
 
 
 
 
 
 
2e681b7
 
88d9212
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from gtts import gTTS

def text_to_speech(text, lang):
    tts = gTTS(text=text, lang=lang)
    tts.save("output.mp3")
    return "output.mp3"

iface = gr.Interface(
    fn=text_to_speech,
    inputs=[
        gr.inputs.Textbox(lines=2, placeholder="Enter your text here..."),
        gr.inputs.Dropdown(choices=["en", "es", "fr", "de", "it"], default="en", label="Language")
    ],
    outputs="audio",
    title="Text to Speech Converter",
    description="Convert your text to speech using this simple interface. Choose the language and enter the text you want to convert."
)

iface.launch()