import gradio as gr from easytts import EasyTTS # Initialize the EasyTTS model tts_model = EasyTTS() def text_to_speech(text_input): # Use EasyTTS to convert text to speech audio_data = tts_model.synthesize(text_input) # Display and play the audio gr.output.Audio(audio_data).play() # Create a Gradio interface iface = gr.Interface(fn=text_to_speech, inputs="text", outputs=None) # Launch the interface iface.launch()