# app.py from gtts import gTTS import gradio as gr import os def text_to_speech(text): tts = gTTS(text) tts.save("output.mp3") return "output.mp3" interface = gr.Interface( fn=text_to_speech, inputs=gr.Textbox(lines=3, label="Enter Text"), outputs=gr.Audio(type="filepath", label="Generated Speech"), title="Text to Speech App", description="Enter any English text and listen to the speech output." ) interface.launch()