zchipitt commited on
Commit
071c978
·
1 Parent(s): f306964

simple melotts app

Browse files
Files changed (2) hide show
  1. app.py +7 -4
  2. requirements.txt +3 -0
app.py CHANGED
@@ -1,7 +1,10 @@
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
1
+ from melo.api import TTS # MeloTTS Python API
2
  import gradio as gr
3
 
4
+ tts_engine = TTS(device='cpu')
5
+ def synth_fn(text):
6
+ wav = tts_engine(text)
7
+ return 22050, wav # 返回采样率和波形数据
8
 
9
+ iface = gr.Interface(fn=synth_fn, inputs="text", outputs="audio")
10
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ meloapi # 若本地部署 MeloTTS
3
+ requests # 若调用 Cloudflare melotts API