Spaces:
Runtime error
Runtime error
Commit
·
f9e95cb
1
Parent(s):
c06b7e2
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,23 @@ kwargs = {'custom_ckpt': custom_infer_abs}
|
|
| 27 |
model_id = SambertHifigan(os.path.join(model_dir, "orig_model"), **kwargs)
|
| 28 |
|
| 29 |
inference = pipeline(task=Tasks.text_to_speech, model=model_id)
|
| 30 |
-
output = inference(input="今天的天气真不错")
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
model_id = SambertHifigan(os.path.join(model_dir, "orig_model"), **kwargs)
|
| 28 |
|
| 29 |
inference = pipeline(task=Tasks.text_to_speech, model=model_id)
|
|
|
|
| 30 |
|
| 31 |
+
def infer(text):
|
| 32 |
+
output = inference(input=text)
|
| 33 |
+
return output["output_wav"]
|
| 34 |
+
|
| 35 |
+
with app:
|
| 36 |
+
gr.HTML("<center>"
|
| 37 |
+
"<h1>🥳🎶🎡 - KanTTS中文声音克隆</h1>"
|
| 38 |
+
"</center>")
|
| 39 |
+
gr.Markdown("### <center>🌊 - 更多精彩应用,敬请关注[滔滔AI](http://www.talktalkai.com);滔滔AI,为爱滔滔!💕</center>")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
with gr.Row():
|
| 43 |
+
with gr.Column():
|
| 44 |
+
inp = gr.Textbox(lines=5, label="请填写您想要转换的中文文本")
|
| 45 |
+
btn = gr.Button("一键生成")
|
| 46 |
+
out = gr.Audio(label="为您生成的专属音频")
|
| 47 |
+
|
| 48 |
+
btn.click(fn=infer, inputs=[inp], outputs=[out])
|
| 49 |
+
|