Modify the my_utils.clean_path() function to correctly handle paths from different operating systems; supplement the input directories for each project to make the operation process smoother.修改my_utils.clean_path()函数,使其能够正确处理不同操作系统路径;补充各项目的输入目录,让操作流程更顺畅。

This commit is contained in:
Kevin-lou 2024-03-17 13:48:20 +08:00
parent c287430ecc
commit bc9cb99323
2 changed files with 22 additions and 10 deletions

View File

@ -26,6 +26,8 @@ def load_audio(file, sr):
def clean_path(path_str):
if platform.system() == 'Windows':
path_str = path_str.replace('/', '\\')
return path_str.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
# 获取当前工作目录
current_dir = os.getcwd()
# 将相对路径转换为绝对路径
absolute_path = os.path.join(current_dir, os.path.normpath(path_str))
return absolute_path

View File

@ -670,6 +670,12 @@ def close1abc():
ps1abc=[]
return "已终止所有一键三连进程", {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False}
def select_list():
list_files = [f for f in os.listdir("output/asr_opt/") if f.endswith('.list')]
if len(list_files) == 0:
return ["无可用列表文件,请先生成列表文件"]
return list_files
with gr.Blocks(title="GPT-SoVITS WebUI") as app:
gr.Markdown(
value=
@ -707,7 +713,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
with gr.Row():
open_denoise_button = gr.Button(i18n("开启语音降噪"), variant="primary",visible=True)
close_denoise_button = gr.Button(i18n("终止语音降噪进程"), variant="primary",visible=False)
denoise_input_dir=gr.Textbox(label=i18n("降噪音频文件输入文件夹"),value="")
denoise_input_dir=gr.Textbox(label=i18n("降噪音频文件输入文件夹"),value="output/slicer_opt")
denoise_output_dir=gr.Textbox(label=i18n("降噪结果输出文件夹"),value="output/denoise_opt")
denoise_info = gr.Textbox(label=i18n("语音降噪进程输出信息"))
gr.Markdown(value=i18n("0c-中文批量离线ASR工具"))
@ -717,8 +723,8 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
with gr.Column():
with gr.Row():
asr_inp_dir = gr.Textbox(
label=i18n("输入文件夹路径"),
value="D:\\GPT-SoVITS\\raw\\xxx",
label=i18n("输入文件夹路径若降噪处理过选output/denoise_opt"),
value="output/slicer_opt",
interactive=True,
)
asr_opt_dir = gr.Textbox(
@ -762,7 +768,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
if_label = gr.Checkbox(label=i18n("是否开启打标WebUI"),show_label=True)
path_list = gr.Textbox(
label=i18n(".list标注文件的路径"),
value="D:\\RVC1006\\GPT-SoVITS\\raw\\xxx.list",
value=select_list()[0],
interactive=True,
)
label_info = gr.Textbox(label=i18n("打标工具进程输出信息"))
@ -785,10 +791,14 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
with gr.TabItem(i18n("1A-训练集格式化工具")):
gr.Markdown(value=i18n("输出logs/实验名目录下应有23456开头的文件和文件夹"))
with gr.Row():
inp_text = gr.Textbox(label=i18n("*文本标注文件"),value=r"D:\RVC1006\GPT-SoVITS\raw\xxx.list",interactive=True)
inp_text = gr.Textbox(
label=i18n("*文本标注文件"),
value=select_list()[0],
interactive=True
)
inp_wav_dir = gr.Textbox(
label=i18n("*训练集音频文件目录"),
# value=r"D:\RVC1006\GPT-SoVITS\raw\xxx",
label=i18n("*训练集音频文件目录若降噪处理过选output/denoise_opt"),
value=r"output/slicer_opt",
interactive=True,
placeholder=i18n("填切割后音频所在目录!读取的音频文件完整路径=该目录-拼接-list文件里波形对应的文件名不是全路径。如果留空则使用.list文件里的绝对全路径。")
)