import gradio as gr from gtts import gTTS import tempfile import os def text_to_speech(text): tts = gTTS(text=text, lang='en') _, temp_path = tempfile.mkstemp(suffix=".mp3") tts.save(temp_path) return temp_path iface = gr.Interface(fn=text_to_speech, inputs="text", outputs="audio") iface.launch(share=True)