Commit
•
7c206f9
1
Parent(s):
4f998e0
Added app
Browse files
app.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import tempfile
|
2 |
+
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
from neon_tts_plugin_coqui import CoquiTTS
|
6 |
+
|
7 |
+
|
8 |
+
LANGUAGES = [
|
9 |
+
"en",
|
10 |
+
"pl",
|
11 |
+
"uk",
|
12 |
+
]
|
13 |
+
|
14 |
+
coquiTTS = CoquiTTS()
|
15 |
+
|
16 |
+
|
17 |
+
def tts(text: str, language: str):
|
18 |
+
print(text, language)
|
19 |
+
# return output
|
20 |
+
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
21 |
+
coquiTTS.get_tts(text, fp, speaker = {"language" : language})
|
22 |
+
return fp.name
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
iface = gr.Interface(
|
27 |
+
fn=tts,
|
28 |
+
inputs=[
|
29 |
+
gr.inputs.Textbox(
|
30 |
+
label="Input",
|
31 |
+
default="Hello, how are you?",
|
32 |
+
),
|
33 |
+
gr.inputs.Radio(
|
34 |
+
label="Pick a Language",
|
35 |
+
choices=LANGUAGES,
|
36 |
+
),
|
37 |
+
],
|
38 |
+
outputs=gr.outputs.Audio(label="Output"),
|
39 |
+
title="🐸💬 - NeonAI Coqui AI TTS Plugin",
|
40 |
+
theme="huggingface",
|
41 |
+
description="🐸💬 - a deep learning toolkit for Text-to-Speech, battle-tested in research and production",
|
42 |
+
article="more info at https://github.com/coqui-ai/TTS",
|
43 |
+
)
|
44 |
+
iface.launch()
|