Spaces:
Running
Running
Upload with huggingface_hub
Browse files- DESCRIPTION.md +1 -0
- README.md +1 -1
- app.py +0 -8
DESCRIPTION.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
This demo converts text to speech in 14 languages.
|
README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
|
2 |
---
|
3 |
title: neon-tts-plugin-coqui
|
4 |
-
emoji:
|
5 |
colorFrom: indigo
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
|
|
1 |
|
2 |
---
|
3 |
title: neon-tts-plugin-coqui
|
4 |
+
emoji: 🔥
|
5 |
colorFrom: indigo
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
app.py
CHANGED
@@ -1,27 +1,19 @@
|
|
1 |
-
# URL: https://huggingface.co/spaces/gradio/neon-tts-plugin-coqui
|
2 |
-
# DESCRIPTION: This demo converts text to speech in 14 languages.
|
3 |
-
# imports
|
4 |
import tempfile
|
5 |
import gradio as gr
|
6 |
from neon_tts_plugin_coqui import CoquiTTS
|
7 |
|
8 |
-
# load the model and set up constants
|
9 |
LANGUAGES = list(CoquiTTS.langs.keys())
|
10 |
coquiTTS = CoquiTTS()
|
11 |
|
12 |
-
# define core fn
|
13 |
def tts(text: str, language: str):
|
14 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
15 |
coquiTTS.get_tts(text, fp, speaker = {"language" : language})
|
16 |
return fp.name
|
17 |
|
18 |
-
# define inputs and outputs
|
19 |
inputs = [gr.Textbox(label="Input", value=CoquiTTS.langs["en"]["sentence"], max_lines=3),
|
20 |
gr.Radio(label="Language", choices=LANGUAGES, value="en")]
|
21 |
outputs = gr.Audio(label="Output")
|
22 |
|
23 |
-
# define interface
|
24 |
demo = gr.Interface(fn=tts, inputs=inputs, outputs=outputs)
|
25 |
|
26 |
-
# launch
|
27 |
demo.launch()
|
|
|
|
|
|
|
|
|
1 |
import tempfile
|
2 |
import gradio as gr
|
3 |
from neon_tts_plugin_coqui import CoquiTTS
|
4 |
|
|
|
5 |
LANGUAGES = list(CoquiTTS.langs.keys())
|
6 |
coquiTTS = CoquiTTS()
|
7 |
|
|
|
8 |
def tts(text: str, language: str):
|
9 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
10 |
coquiTTS.get_tts(text, fp, speaker = {"language" : language})
|
11 |
return fp.name
|
12 |
|
|
|
13 |
inputs = [gr.Textbox(label="Input", value=CoquiTTS.langs["en"]["sentence"], max_lines=3),
|
14 |
gr.Radio(label="Language", choices=LANGUAGES, value="en")]
|
15 |
outputs = gr.Audio(label="Output")
|
16 |
|
|
|
17 |
demo = gr.Interface(fn=tts, inputs=inputs, outputs=outputs)
|
18 |
|
|
|
19 |
demo.launch()
|