import tempfile import gradio as gr from neon_tts_plugin_coqui import CoquiTTS coquiTTS = CoquiTTS() def tts(text: str): with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp: coquiTTS.get_tts(text, fp) return fp.name # def text_to_audio(text): # # Generate audio from text using gTTS # tts = gTTS(text=text, lang='en', slow=False) # tts.save("test.wav") # return 'test.wav' iface = gr.Interface(fn = tts, inputs = 'text', outputs = 'audio', verbose = True, ) iface.launch()