Spaces:
Running
Running
Upload 3 files
Browse files- app.py +16 -11
- models/otto/otto-e10.ckpt +3 -0
- models/otto/otto_e39_s1638.pth +3 -0
app.py
CHANGED
@@ -10,9 +10,9 @@ logging.getLogger("torchaudio._extension").setLevel(logging.ERROR)
|
|
10 |
import pdb
|
11 |
|
12 |
gpt_path = os.environ.get(
|
13 |
-
"gpt_path", "models/
|
14 |
)
|
15 |
-
sovits_path = os.environ.get("sovits_path", "models/
|
16 |
cnhubert_base_path = os.environ.get(
|
17 |
"cnhubert_base_path", "pretrained_models/chinese-hubert-base"
|
18 |
)
|
@@ -427,6 +427,9 @@ def cut2(inp):
|
|
427 |
def cut3(inp):
|
428 |
inp = inp.strip("\n")
|
429 |
return "\n".join(["%s。" % item for item in inp.strip("。").split("。")])
|
|
|
|
|
|
|
430 |
|
431 |
def scan_audio_files(folder_path):
|
432 |
""" 扫描指定文件夹获取音频文件列表 """
|
@@ -446,17 +449,17 @@ def load_audio_text_mappings(folder_path, list_file_name):
|
|
446 |
audio_to_text_mappings[audio_file_path] = text
|
447 |
return text_to_audio_mappings, audio_to_text_mappings
|
448 |
|
449 |
-
audio_folder_path = 'audio/
|
450 |
-
text_to_audio_mappings, audio_to_text_mappings = load_audio_text_mappings(audio_folder_path, '
|
451 |
|
452 |
with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
453 |
gr.Markdown(value="""
|
454 |
-
# <center>【AI
|
455 |
|
456 |
### <center>模型作者:Xz乔希 https://space.bilibili.com/5859321\n
|
457 |
### <center>【GPT-SoVITS】在线合集:https://www.modelscope.cn/studios/xzjosh/GPT-SoVITS\n
|
458 |
### <center>数据集下载:https://huggingface.co/datasets/XzJosh/audiodataset\n
|
459 |
-
### <center
|
460 |
### <center>GPT-SoVITS项目:https://github.com/RVC-Boss/GPT-SoVITS\n
|
461 |
### <center>使用本模型请严格遵守法律法规!发布二创作品请标注本项目作者及链接、作品使用GPT-SoVITS AI生成!\n
|
462 |
### <center>⚠️在线端不稳定且生成速度较慢,强烈建议下载模型本地推理!\n
|
@@ -464,9 +467,9 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
|
464 |
# with gr.Tabs():
|
465 |
|
466 |
with gr.Group():
|
467 |
-
gr.Markdown(value="
|
468 |
with gr.Row():
|
469 |
-
audio_select = gr.Dropdown(label="
|
470 |
ref_audio = gr.Audio(label="参考音频试听")
|
471 |
ref_text = gr.Textbox(label="参考音频文本")
|
472 |
|
@@ -489,9 +492,9 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
|
489 |
label="需要合成的语种", choices=["中文", "英文", "日文"], value="中文"
|
490 |
)
|
491 |
how_to_cut = gr.Radio(
|
492 |
-
label=("
|
493 |
choices=[("不切"),("凑五句一切"),("凑50字一切"),("按中文句号。切"),("按英文句号.切"),],
|
494 |
-
value=("
|
495 |
interactive=True,
|
496 |
)
|
497 |
inference_button = gr.Button("合成语音", variant="primary")
|
@@ -503,16 +506,18 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
|
503 |
)
|
504 |
|
505 |
|
506 |
-
gr.Markdown(value="
|
507 |
with gr.Row():
|
508 |
text_inp = gr.Textbox(label="需要合成的切分前文本", value="")
|
509 |
button1 = gr.Button("凑五句一切", variant="primary")
|
510 |
button2 = gr.Button("凑50字一切", variant="primary")
|
511 |
button3 = gr.Button("按中文句号。切", variant="primary")
|
|
|
512 |
text_opt = gr.Textbox(label="切分后文本", value="")
|
513 |
button1.click(cut1, [text_inp], [text_opt])
|
514 |
button2.click(cut2, [text_inp], [text_opt])
|
515 |
button3.click(cut3, [text_inp], [text_opt])
|
|
|
516 |
|
517 |
app.queue(max_size=10)
|
518 |
app.launch(inbrowser=True)
|
|
|
10 |
import pdb
|
11 |
|
12 |
gpt_path = os.environ.get(
|
13 |
+
"gpt_path", "models/otto/otto-e10.ckpt"
|
14 |
)
|
15 |
+
sovits_path = os.environ.get("sovits_path", "models/otto/otto_e39_s1638.pth")
|
16 |
cnhubert_base_path = os.environ.get(
|
17 |
"cnhubert_base_path", "pretrained_models/chinese-hubert-base"
|
18 |
)
|
|
|
427 |
def cut3(inp):
|
428 |
inp = inp.strip("\n")
|
429 |
return "\n".join(["%s。" % item for item in inp.strip("。").split("。")])
|
430 |
+
def cut4(inp):
|
431 |
+
inp = inp.strip("\n")
|
432 |
+
return "\n".join(["%s." % item for item in inp.strip(".").split(".")])
|
433 |
|
434 |
def scan_audio_files(folder_path):
|
435 |
""" 扫描指定文件夹获取音频文件列表 """
|
|
|
449 |
audio_to_text_mappings[audio_file_path] = text
|
450 |
return text_to_audio_mappings, audio_to_text_mappings
|
451 |
|
452 |
+
audio_folder_path = 'audio/otto'
|
453 |
+
text_to_audio_mappings, audio_to_text_mappings = load_audio_text_mappings(audio_folder_path, 'otto.list')
|
454 |
|
455 |
with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
456 |
gr.Markdown(value="""
|
457 |
+
# <center>【AI电棍】在线语音生成(GPT-SoVITS)\n
|
458 |
|
459 |
### <center>模型作者:Xz乔希 https://space.bilibili.com/5859321\n
|
460 |
### <center>【GPT-SoVITS】在线合集:https://www.modelscope.cn/studios/xzjosh/GPT-SoVITS\n
|
461 |
### <center>数据集下载:https://huggingface.co/datasets/XzJosh/audiodataset\n
|
462 |
+
### <center>声音归属:电棍otto https://space.bilibili.com/628845081\n
|
463 |
### <center>GPT-SoVITS项目:https://github.com/RVC-Boss/GPT-SoVITS\n
|
464 |
### <center>使用本模型请严格遵守法律法规!发布二创作品请标注本项目作者及链接、作品使用GPT-SoVITS AI生成!\n
|
465 |
### <center>⚠️在线端不稳定且生成速度较慢,强烈建议下载模型本地推理!\n
|
|
|
467 |
# with gr.Tabs():
|
468 |
|
469 |
with gr.Group():
|
470 |
+
gr.Markdown(value="*参考音频选择(不建议选较长的)")
|
471 |
with gr.Row():
|
472 |
+
audio_select = gr.Dropdown(label="选择参考音频(必选)", choices=list(text_to_audio_mappings.keys()))
|
473 |
ref_audio = gr.Audio(label="参考音频试听")
|
474 |
ref_text = gr.Textbox(label="参考音频文本")
|
475 |
|
|
|
492 |
label="需要合成的语种", choices=["中文", "英文", "日文"], value="中文"
|
493 |
)
|
494 |
how_to_cut = gr.Radio(
|
495 |
+
label=("自动切分(长文本建议切分)"),
|
496 |
choices=[("不切"),("凑五句一切"),("凑50字一切"),("按中文句号。切"),("按英文句号.切"),],
|
497 |
+
value=("不切"),
|
498 |
interactive=True,
|
499 |
)
|
500 |
inference_button = gr.Button("合成语音", variant="primary")
|
|
|
506 |
)
|
507 |
|
508 |
|
509 |
+
gr.Markdown(value="文本切分工具,需要复制。")
|
510 |
with gr.Row():
|
511 |
text_inp = gr.Textbox(label="需要合成的切分前文本", value="")
|
512 |
button1 = gr.Button("凑五句一切", variant="primary")
|
513 |
button2 = gr.Button("凑50字一切", variant="primary")
|
514 |
button3 = gr.Button("按中文句号。切", variant="primary")
|
515 |
+
button4 = gr.Button("按英文句号.切", variant="primary")
|
516 |
text_opt = gr.Textbox(label="切分后文本", value="")
|
517 |
button1.click(cut1, [text_inp], [text_opt])
|
518 |
button2.click(cut2, [text_inp], [text_opt])
|
519 |
button3.click(cut3, [text_inp], [text_opt])
|
520 |
+
button4.click(cut4, [text_inp], [text_opt])
|
521 |
|
522 |
app.queue(max_size=10)
|
523 |
app.launch(inbrowser=True)
|
models/otto/otto-e10.ckpt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:02170064a054cc6e6532f884a00b8f509c2d345069c0b6c1c2dd9921f9e7b62f
|
3 |
+
size 155084623
|
models/otto/otto_e39_s1638.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a3cd9a330d13c1d2ddaeb1ba4a6a2739cd8bcd386fbc2e6ec88f96f0e591c317
|
3 |
+
size 84929843
|