Spaces:
Runtime error
Runtime error
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() | |