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()