mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-10-07 07:02:57 +08:00
Merge f08041a4d13e6a841472ad9a701da62e7c25c4ab into 41041715a45dc56b98daf8c425ff617d3e6fd26e
This commit is contained in:
commit
77b406845b
@ -6,7 +6,7 @@
|
|||||||
全部按英文识别
|
全部按英文识别
|
||||||
全部按日文识别
|
全部按日文识别
|
||||||
'''
|
'''
|
||||||
import os, re, logging
|
import os, re, logging, random
|
||||||
import LangSegment
|
import LangSegment
|
||||||
logging.getLogger("markdown_it").setLevel(logging.ERROR)
|
logging.getLogger("markdown_it").setLevel(logging.ERROR)
|
||||||
logging.getLogger("urllib3").setLevel(logging.ERROR)
|
logging.getLogger("urllib3").setLevel(logging.ERROR)
|
||||||
@ -359,6 +359,15 @@ def merge_short_text_in_array(texts, threshold):
|
|||||||
result[len(result) - 1] += text
|
result[len(result) - 1] += text
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def set_seed(seed):
|
||||||
|
seed = seed if seed != -1 else random.randrange(1 << 32)
|
||||||
|
torch.manual_seed(seed)
|
||||||
|
print("Seed:", seed)
|
||||||
|
return seed
|
||||||
|
|
||||||
|
def reuse_seed(seed):
|
||||||
|
return seed
|
||||||
|
|
||||||
def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language, how_to_cut=i18n("不切")):
|
def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language, how_to_cut=i18n("不切")):
|
||||||
t0 = ttime()
|
t0 = ttime()
|
||||||
prompt_language = dict_language[prompt_language]
|
prompt_language = dict_language[prompt_language]
|
||||||
@ -587,58 +596,68 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
|||||||
gr.Markdown(
|
gr.Markdown(
|
||||||
value=i18n("本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>LICENSE</b>.")
|
value=i18n("本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>LICENSE</b>.")
|
||||||
)
|
)
|
||||||
with gr.Group():
|
|
||||||
gr.Markdown(value=i18n("模型切换"))
|
gr.Markdown(value=i18n("模型切换"))
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
GPT_dropdown = gr.Dropdown(label=i18n("GPT模型列表"), choices=sorted(GPT_names, key=custom_sort_key), value=gpt_path, interactive=True)
|
GPT_dropdown = gr.Dropdown(label=i18n("GPT模型列表"), choices=sorted(GPT_names, key=custom_sort_key), value=gpt_path, interactive=True)
|
||||||
SoVITS_dropdown = gr.Dropdown(label=i18n("SoVITS模型列表"), choices=sorted(SoVITS_names, key=custom_sort_key), value=sovits_path, interactive=True)
|
SoVITS_dropdown = gr.Dropdown(label=i18n("SoVITS模型列表"), choices=sorted(SoVITS_names, key=custom_sort_key), value=sovits_path, interactive=True)
|
||||||
refresh_button = gr.Button(i18n("刷新模型路径"), variant="primary")
|
refresh_button = gr.Button(i18n("刷新模型路径"), variant="primary")
|
||||||
refresh_button.click(fn=change_choices, inputs=[], outputs=[SoVITS_dropdown, GPT_dropdown])
|
refresh_button.click(fn=change_choices, inputs=[], outputs=[SoVITS_dropdown, GPT_dropdown])
|
||||||
SoVITS_dropdown.change(change_sovits_weights, [SoVITS_dropdown], [])
|
SoVITS_dropdown.change(change_sovits_weights, [SoVITS_dropdown], [])
|
||||||
GPT_dropdown.change(change_gpt_weights, [GPT_dropdown], [])
|
GPT_dropdown.change(change_gpt_weights, [GPT_dropdown], [])
|
||||||
gr.Markdown(value=i18n("*请上传并填写参考信息"))
|
|
||||||
with gr.Row():
|
gr.Markdown(value=i18n("*请上传并填写参考信息"))
|
||||||
inp_ref = gr.Audio(label=i18n("请上传3~10秒内参考音频,超过会报错!"), type="filepath")
|
with gr.Row():
|
||||||
prompt_text = gr.Textbox(label=i18n("参考音频的文本"), value="")
|
inp_ref = gr.Audio(label=i18n("请上传3~10秒内参考音频,超过会报错!"), type="filepath")
|
||||||
prompt_language = gr.Dropdown(
|
prompt_text = gr.Textbox(label=i18n("参考音频的文本"), value="")
|
||||||
label=i18n("参考音频的语种"), choices=[i18n("中文"), i18n("英文"), i18n("日文"), i18n("中英混合"), i18n("日英混合"), i18n("多语种混合")], value=i18n("中文")
|
prompt_language = gr.Dropdown(
|
||||||
)
|
label=i18n("参考音频的语种"), choices=[i18n("中文"), i18n("英文"), i18n("日文"), i18n("中英混合"), i18n("日英混合"), i18n("多语种混合")], value=i18n("中文")
|
||||||
gr.Markdown(value=i18n("*请填写需要合成的目标文本。中英混合选中文,日英混合选日文,中日混合暂不支持,非目标语言文本自动遗弃。"))
|
)
|
||||||
with gr.Row():
|
|
||||||
text = gr.Textbox(label=i18n("需要合成的文本"), value="")
|
gr.Markdown(value=i18n("*请填写需要合成的目标文本。中英混合选中文,日英混合选日文,中日混合暂不支持,非目标语言文本自动遗弃。"))
|
||||||
|
with gr.Row():
|
||||||
|
with gr.Column():
|
||||||
|
text = gr.Textbox(label=i18n("需要合成的文本"), value="", lines=5)
|
||||||
text_language = gr.Dropdown(
|
text_language = gr.Dropdown(
|
||||||
label=i18n("需要合成的语种"), choices=[i18n("中文"), i18n("英文"), i18n("日文"), i18n("中英混合"), i18n("日英混合"), i18n("多语种混合")], value=i18n("中文")
|
label=i18n("需要合成的语种"), choices=[i18n("中文"), i18n("英文"), i18n("日文"), i18n("中英混合"), i18n("日英混合"), i18n("多语种混合")], value=i18n("中文")
|
||||||
)
|
)
|
||||||
|
with gr.Column():
|
||||||
how_to_cut = gr.Radio(
|
how_to_cut = gr.Radio(
|
||||||
label=i18n("怎么切"),
|
label=i18n("怎么切"),
|
||||||
choices=[i18n("不切"), i18n("凑四句一切"), i18n("凑50字一切"), i18n("按中文句号。切"), i18n("按英文句号.切"), i18n("按标点符号切"), ],
|
choices=[i18n("不切"), i18n("凑四句一切"), i18n("凑50字一切"), i18n("按中文句号。切"), i18n("按英文句号.切"), i18n("按标点符号切"), ],
|
||||||
value=i18n("凑四句一切"),
|
value=i18n("凑四句一切"),
|
||||||
interactive=True,
|
interactive=True,
|
||||||
)
|
)
|
||||||
|
with gr.Row():
|
||||||
|
seed = gr.Number(label=i18n("种子"), value=-1, precision=0)
|
||||||
|
last_seed = gr.State(value=-1)
|
||||||
|
reuse_button = gr.Button(value=i18n("种子复用"))
|
||||||
|
with gr.Column():
|
||||||
inference_button = gr.Button(i18n("合成语音"), variant="primary")
|
inference_button = gr.Button(i18n("合成语音"), variant="primary")
|
||||||
output = gr.Audio(label=i18n("输出的语音"))
|
output = gr.Audio(label=i18n("输出的语音"))
|
||||||
|
inference_button.click(set_seed, seed, last_seed).then(
|
||||||
inference_button.click(
|
|
||||||
get_tts_wav,
|
get_tts_wav,
|
||||||
[inp_ref, prompt_text, prompt_language, text, text_language, how_to_cut],
|
[inp_ref, prompt_text, prompt_language, text, text_language, how_to_cut],
|
||||||
[output],
|
[output],
|
||||||
)
|
)
|
||||||
|
reuse_button.click(reuse_seed, last_seed, seed)
|
||||||
|
|
||||||
gr.Markdown(value=i18n("文本切分工具。太长的文本合成出来效果不一定好,所以太长建议先切。合成会根据文本的换行分开合成再拼起来。"))
|
gr.Markdown(value=i18n("文本切分工具。太长的文本合成出来效果不一定好,所以太长建议先切。合成会根据文本的换行分开合成再拼起来。"))
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
text_inp = gr.Textbox(label=i18n("需要合成的切分前文本"), value="")
|
text_inp = gr.Textbox(label=i18n("需要合成的切分前文本"), value="")
|
||||||
button1 = gr.Button(i18n("凑四句一切"), variant="primary")
|
button1 = gr.Button(i18n("凑四句一切"), variant="primary")
|
||||||
button2 = gr.Button(i18n("凑50字一切"), variant="primary")
|
button2 = gr.Button(i18n("凑50字一切"), variant="primary")
|
||||||
button3 = gr.Button(i18n("按中文句号。切"), variant="primary")
|
button3 = gr.Button(i18n("按中文句号。切"), variant="primary")
|
||||||
button4 = gr.Button(i18n("按英文句号.切"), variant="primary")
|
button4 = gr.Button(i18n("按英文句号.切"), variant="primary")
|
||||||
button5 = gr.Button(i18n("按标点符号切"), variant="primary")
|
button5 = gr.Button(i18n("按标点符号切"), variant="primary")
|
||||||
text_opt = gr.Textbox(label=i18n("切分后文本"), value="")
|
text_opt = gr.Textbox(label=i18n("切分后文本"), value="")
|
||||||
button1.click(cut1, [text_inp], [text_opt])
|
button1.click(cut1, [text_inp], [text_opt])
|
||||||
button2.click(cut2, [text_inp], [text_opt])
|
button2.click(cut2, [text_inp], [text_opt])
|
||||||
button3.click(cut3, [text_inp], [text_opt])
|
button3.click(cut3, [text_inp], [text_opt])
|
||||||
button4.click(cut4, [text_inp], [text_opt])
|
button4.click(cut4, [text_inp], [text_opt])
|
||||||
button5.click(cut5, [text_inp], [text_opt])
|
button5.click(cut5, [text_inp], [text_opt])
|
||||||
gr.Markdown(value=i18n("后续将支持混合语种编码文本输入。"))
|
|
||||||
|
gr.Markdown(value=i18n("后续将支持混合语种编码文本输入。"))
|
||||||
|
|
||||||
app.queue(concurrency_count=511, max_size=1022).launch(
|
app.queue(concurrency_count=511, max_size=1022).launch(
|
||||||
server_name="0.0.0.0",
|
server_name="0.0.0.0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user