aliabd HF staff commited on
Commit
02ce46b
1 Parent(s): 56bb714

Upload with huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +2 -1
  2. app.py +19 -0
README.md CHANGED
@@ -6,6 +6,7 @@ colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 3.4.1
9
- app_file: run.py
 
10
  pinned: false
11
  ---
 
6
  colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 3.4.1
9
+
10
+ app_file: app.py
11
  pinned: false
12
  ---
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()