diff --git a/webui.py b/webui.py index c7113b0..fa40c3a 100644 --- a/webui.py +++ b/webui.py @@ -197,11 +197,12 @@ def open_asr(asr_inp_dir, asr_opt_dir, asr_model, asr_model_size, asr_lang): global p_asr if(p_asr==None): asr_inp_dir=my_utils.clean_path(asr_inp_dir) - cmd = f"{python_exec} tools/asr/{asr_dict[asr_model]['path']}" - cmd += f" -i {asr_inp_dir}" - cmd += f" -o {asr_opt_dir}" - cmd += f" -s {asr_model_size}" - cmd += f" -l {asr_lang}" + cmd = f'"{python_exec}" tools/asr/{asr_dict[asr_model]["path"]}' + cmd += f' -i "{asr_inp_dir}"' + cmd += f' -o "{asr_opt_dir}"' + cmd += f' -s {asr_model_size}' + cmd += f' -l {asr_lang}' + cmd += " -p %s"%("float16"if is_half==True else "float32") yield "ASR任务开启:%s"%cmd,{"__type__":"update","visible":False},{"__type__":"update","visible":True} print(cmd) @@ -211,7 +212,7 @@ def open_asr(asr_inp_dir, asr_opt_dir, asr_model, asr_model_size, asr_lang): yield f"ASR任务完成, 查看终端进行下一步",{"__type__":"update","visible":True},{"__type__":"update","visible":False} else: yield "已有正在进行的ASR任务,需先终止才能开启下一次任务",{"__type__":"update","visible":False},{"__type__":"update","visible":True} - return None + # return None def close_asr(): global p_asr @@ -684,39 +685,44 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: with gr.Row(): asr_inp_dir = gr.Textbox( label=i18n("输入文件夹路径"), - value="D:\\RVC1006\\GPT-SoVITS\\raw\\xxx", + value="D:\\GPT-SoVITS\\raw\\xxx", interactive=True, ) asr_opt_dir = gr.Textbox( label = i18n("输出文件夹路径"), value = "output/asr_opt", - interactive = False, + interactive = True, ) with gr.Row(): asr_model = gr.Dropdown( label = i18n("ASR 模型"), choices = list(asr_dict.keys()), interactive = True, + value="达摩 ASR (中文)" ) asr_size = gr.Dropdown( label = i18n("ASR 模型尺寸"), - choices = [], + choices = ["large"], interactive = True, + value="large" ) asr_lang = gr.Dropdown( label = i18n("ASR 语言设置"), - choices = [], + choices = ["zh"], interactive = True, + value="zh" ) with gr.Row(): asr_info = gr.Textbox(label=i18n("ASR进程输出信息")) def change_lang_choices(key): #根据选择的模型修改可选的语言 - return gr.Dropdown(choices=asr_dict[key]['lang']) + # return gr.Dropdown(choices=asr_dict[key]['lang']) + return {"__type__": "update", "choices": asr_dict[key]['lang'],"value":asr_dict[key]['lang'][0]} def change_size_choices(key): # 根据选择的模型修改可选的模型尺寸 - return gr.Dropdown(choices=asr_dict[key]['size']) - asr_model.change(change_lang_choices, asr_model, asr_lang) - asr_model.change(change_size_choices, asr_model, asr_size) + # return gr.Dropdown(choices=asr_dict[key]['size']) + return {"__type__": "update", "choices": asr_dict[key]['size']} + asr_model.change(change_lang_choices, [asr_model], [asr_lang]) + asr_model.change(change_size_choices, [asr_model], [asr_size]) gr.Markdown(value=i18n("0d-语音文本校对标注工具")) with gr.Row():