import tempfile import gradio as gr from neon_tts_plugin_coqui import CoquiTTS language_phrases = { "en": "Hello, how are you?", "pl": "Witam, jak się masz?", "uk": "Привіт, як твої справи?", } LANGUAGES = list(language_phrases.keys()) title = "🐸💬 - NeonAI Coqui AI TTS Plugin" description = "🐸💬 - a deep learning toolkit for Text-to-Speech, battle-tested in research and production" info = "more info at [Neon Coqui TTS Plugin](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui), [Coqui TTS](https://github.com/coqui-ai/TTS)" badge = "https://visitor-badge-reloaded.herokuapp.com/badge?page_id=neongeckocom.neon-tts-plugin-coqui" 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 with gr.Blocks() as blocks: gr.Markdown("