weijiang2009 commited on
Commit
4d7193b
·
1 Parent(s): 4b9d080

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -13
app.py CHANGED
@@ -1,20 +1,25 @@
 
1
  import os
2
 
3
- import gradio as gr
4
- from paddlespeech.cli import TTSExecutor
 
5
 
6
- tts_executor = TTSExecutor()
7
 
 
8
 
9
- def speech_generate(text: str) -> os.PathLike:
10
- assert isinstance(text, str) and len(text) > 0, 'Input Chinese text...'
11
- wav_file = tts_executor(text=text)
12
- return wav_file
13
 
 
14
 
15
- iface = gr.Interface(
16
- fn=speech_generate,
17
- inputs=gr.inputs.Textbox(placeholder='请输入文字...'),
18
- outputs=gr.outputs.Audio(),
19
- )
20
- iface.launch()
 
 
 
 
 
1
+ import gradio as gr
2
  import os
3
 
4
+ def inference(text):
5
+ os.system("paddlespeech tts --input '"+text+"' --output output.wav")
6
+ return "output.wav"
7
 
8
+ title = "Algmon Speech TTS"
9
 
10
+ description = "Gradio demo for Algmon Speech: A Speech Toolkit based on PaddlePaddle for TTS. To use it, simply add your text, or click one of the examples to load them. Read more at the links below."
11
 
12
+ article = "<p style='text-align: center'><a href='' target='_blank'>Git Repo</a></p>"
 
 
 
13
 
14
+ examples=[['你好,欢迎使用Algmon语音合成']]
15
 
16
+ gr.Interface(
17
+ inference,
18
+ gr.inputs.Textbox(label="input text",lines=10),
19
+ gr.outputs.Audio(type="file", label="Output"),
20
+ title=title,
21
+ description=description,
22
+ article=article,
23
+ enable_queue=True,
24
+ examples=examples
25
+ ).launch(debug=True)