simple melotts app
Browse files- app.py +7 -4
- requirements.txt +3 -0
app.py
CHANGED
@@ -1,7 +1,10 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
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
|