Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -382,25 +382,30 @@ if __name__ == "__main__":
|
|
382 |
)
|
383 |
speaker_ids = hps.data.spk2id
|
384 |
speakers = list(speaker_ids.keys())
|
385 |
-
languages = ["ZH", "JP", "EN", "
|
386 |
with gr.Blocks() as app:
|
387 |
with gr.Row():
|
388 |
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
text = gr.TextArea(
|
390 |
label="输入文本内容",
|
391 |
placeholder="""
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
...
|
398 |
-
另外,所有的语言选项都可以用'|'分割长段实现分句生成。
|
399 |
""",
|
400 |
)
|
401 |
-
trans = gr.Button("中翻日", variant="primary")
|
402 |
-
slicer = gr.Button("快速切分", variant="primary")
|
403 |
-
formatter = gr.Button("检测语言,并整理为 MIX 格式", variant="primary")
|
404 |
speaker = gr.Dropdown(
|
405 |
choices=speakers, value=speakers[0], label="Speaker"
|
406 |
)
|
@@ -424,21 +429,21 @@ if __name__ == "__main__":
|
|
424 |
label="Audio prompt", type="filepath", visible=False
|
425 |
)
|
426 |
sdp_ratio = gr.Slider(
|
427 |
-
minimum=0, maximum=1, value=0.5, step=0.
|
428 |
)
|
429 |
noise_scale = gr.Slider(
|
430 |
-
minimum=0.1, maximum=2, value=0.
|
431 |
)
|
432 |
noise_scale_w = gr.Slider(
|
433 |
-
minimum=0.1, maximum=2, value=0.9, step=0.
|
434 |
)
|
435 |
length_scale = gr.Slider(
|
436 |
-
minimum=0.1, maximum=2, value=1.0, step=0.
|
437 |
)
|
438 |
language = gr.Dropdown(
|
439 |
choices=languages, value=languages[0], label="Language"
|
440 |
)
|
441 |
-
btn = gr.Button("
|
442 |
with gr.Column():
|
443 |
with gr.Accordion("融合文本语义", open=False):
|
444 |
gr.Markdown(
|
@@ -502,12 +507,6 @@ if __name__ == "__main__":
|
|
502 |
],
|
503 |
outputs=[text_output, audio_output],
|
504 |
)
|
505 |
-
|
506 |
-
trans.click(
|
507 |
-
translate,
|
508 |
-
inputs=[text],
|
509 |
-
outputs=[text],
|
510 |
-
)
|
511 |
slicer.click(
|
512 |
tts_split,
|
513 |
inputs=[
|
@@ -541,12 +540,6 @@ if __name__ == "__main__":
|
|
541 |
outputs=[audio_prompt],
|
542 |
)
|
543 |
|
544 |
-
formatter.click(
|
545 |
-
format_utils,
|
546 |
-
inputs=[text, speaker],
|
547 |
-
outputs=[language, text],
|
548 |
-
)
|
549 |
-
|
550 |
print("推理页面已开启!")
|
551 |
webbrowser.open(f"http://127.0.0.1:{config.webui_config.port}")
|
552 |
app.launch(share=config.webui_config.share, server_port=config.webui_config.port)
|
|
|
382 |
)
|
383 |
speaker_ids = hps.data.spk2id
|
384 |
speakers = list(speaker_ids.keys())
|
385 |
+
languages = ["ZH", "JP", "EN", "auto", "mix"]
|
386 |
with gr.Blocks() as app:
|
387 |
with gr.Row():
|
388 |
with gr.Column():
|
389 |
+
gr.Markdown(value="""
|
390 |
+
【AI阿梓2.0】在线语音合成(Bert-Vits2 2.3中日英)\n
|
391 |
+
作者:Xz乔希 https://space.bilibili.com/5859321\n
|
392 |
+
声音归属:阿梓从小就很可爱 https://space.bilibili.com/7706705\n
|
393 |
+
【AI合集】https://www.modelscope.cn/studios/xzjosh/Bert-VITS2\n
|
394 |
+
Bert-VITS2项目:https://github.com/Stardust-minus/Bert-VITS2\n
|
395 |
+
使用本模型请严格遵守法律法规!\n
|
396 |
+
发布二创作品请标注本项目作者及链接、作品使用Bert-VITS2 AI生成!\n
|
397 |
+
【提示】手机端容易误触调节,请刷新恢复默认!每次生成的结果都不一样,效果不好请尝试多次生成与调节,选择最佳结果!\n
|
398 |
+
""")
|
399 |
text = gr.TextArea(
|
400 |
label="输入文本内容",
|
401 |
placeholder="""
|
402 |
+
推荐不同语言分开推理,因为无法连贯且可能影响最终效果!
|
403 |
+
如果选择语言为\'mix\',必须按照格式输入,否则报错:
|
404 |
+
格式举例(zh是中文,jp是日语,en是英语;不区分大小写):
|
405 |
+
[说话人]<zh>你好 <jp>こんにちは <en>Hello
|
406 |
+
另外,所有的语言选项都可以用'|'分割长段实现分句生成。
|
|
|
|
|
407 |
""",
|
408 |
)
|
|
|
|
|
|
|
409 |
speaker = gr.Dropdown(
|
410 |
choices=speakers, value=speakers[0], label="Speaker"
|
411 |
)
|
|
|
429 |
label="Audio prompt", type="filepath", visible=False
|
430 |
)
|
431 |
sdp_ratio = gr.Slider(
|
432 |
+
minimum=0, maximum=1, value=0.5, step=0.01, label="SDP Ratio"
|
433 |
)
|
434 |
noise_scale = gr.Slider(
|
435 |
+
minimum=0.1, maximum=2, value=0.5, step=0.01, label="Noise"
|
436 |
)
|
437 |
noise_scale_w = gr.Slider(
|
438 |
+
minimum=0.1, maximum=2, value=0.9, step=0.01, label="Noise_W"
|
439 |
)
|
440 |
length_scale = gr.Slider(
|
441 |
+
minimum=0.1, maximum=2, value=1.0, step=0.01, label="Length"
|
442 |
)
|
443 |
language = gr.Dropdown(
|
444 |
choices=languages, value=languages[0], label="Language"
|
445 |
)
|
446 |
+
btn = gr.Button("点击生成", variant="primary")
|
447 |
with gr.Column():
|
448 |
with gr.Accordion("融合文本语义", open=False):
|
449 |
gr.Markdown(
|
|
|
507 |
],
|
508 |
outputs=[text_output, audio_output],
|
509 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
slicer.click(
|
511 |
tts_split,
|
512 |
inputs=[
|
|
|
540 |
outputs=[audio_prompt],
|
541 |
)
|
542 |
|
|
|
|
|
|
|
|
|
|
|
|
|
543 |
print("推理页面已开启!")
|
544 |
webbrowser.open(f"http://127.0.0.1:{config.webui_config.port}")
|
545 |
app.launch(share=config.webui_config.share, server_port=config.webui_config.port)
|