import tempfile import gradio as gr from neon_tts_plugin_coqui import CoquiTTS LANGUAGES = [ "en", "pl", "uk", ] coquiTTS = CoquiTTS() def tts(text: str, language: str): print(text, language) # return output with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp: coquiTTS.get_tts(text, fp, speaker = {"language" : language}) return fp.name iface = gr.Interface( fn=tts, inputs=[ gr.inputs.Textbox( label="Input", default="Hello, how are you?", ), gr.inputs.Radio( label="Pick a Language", choices=LANGUAGES, ), ], outputs=gr.outputs.Audio(label="Output"), title="πŸΈπŸ’¬ - NeonAI Coqui AI TTS Plugin", theme="huggingface", description="πŸΈπŸ’¬ - a deep learning toolkit for Text-to-Speech, battle-tested in research and production", article="more info at https://github.com/coqui-ai/TTS", ) iface.launch()