From 6da486c15d09e3d99fa42c5e560aaac56b6b4ce1 Mon Sep 17 00:00:00 2001 From: RVC-Boss <129054828+RVC-Boss@users.noreply.github.com> Date: Wed, 21 Feb 2024 18:27:59 +0800 Subject: [PATCH] Add files via upload --- webui.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/webui.py b/webui.py index cff7cdb..c6430d9 100644 --- a/webui.py +++ b/webui.py @@ -117,6 +117,7 @@ def change_choices(): p_label=None p_uvr5=None p_asr=None +p_denoise=None p_tts_inference=None def kill_proc_tree(pid, including_parent=True): @@ -220,6 +221,29 @@ def close_asr(): kill_process(p_asr.pid) p_asr=None return "已终止ASR进程",{"__type__":"update","visible":True},{"__type__":"update","visible":False} +def open_denoise(denoise_inp_dir, denoise_opt_dir): + global p_denoise + if(p_denoise==None): + denoise_inp_dir=my_utils.clean_path(denoise_inp_dir) + denoise_opt_dir=my_utils.clean_path(denoise_opt_dir) + cmd = '"%s" tools/cmd-denoise.py -i "%s" -o "%s" -p %s'%(python_exec,denoise_inp_dir,denoise_opt_dir,"float16"if is_half==True else "float32") + + yield "语音降噪任务开启:%s"%cmd,{"__type__":"update","visible":False},{"__type__":"update","visible":True} + print(cmd) + p_denoise = Popen(cmd, shell=True) + p_denoise.wait() + p_denoise=None + yield f"语音降噪任务完成, 查看终端进行下一步",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + else: + yield "已有正在进行的语音降噪任务,需先终止才能开启下一次任务",{"__type__":"update","visible":False},{"__type__":"update","visible":True} + # return None + +def close_denoise(): + global p_denoise + if(p_denoise!=None): + kill_process(p_denoise.pid) + p_denoise=None + return "已终止语音降噪进程",{"__type__":"update","visible":True},{"__type__":"update","visible":False} p_train_SoVITS=None def open1Ba(batch_size,total_epoch,exp_name,text_low_lr_rate,if_save_latest,if_save_every_weights,save_every_epoch,gpu_numbers1Ba,pretrained_s2G,pretrained_s2D): @@ -678,6 +702,13 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: alpha=gr.Slider(minimum=0,maximum=1,step=0.05,label=i18n("alpha_mix:混多少比例归一化后音频进来"),value=0.25,interactive=True) n_process=gr.Slider(minimum=1,maximum=n_cpu,step=1,label=i18n("切割使用的进程数"),value=4,interactive=True) slicer_info = gr.Textbox(label=i18n("语音切割进程输出信息")) + gr.Markdown(value=i18n("0bb-语音降噪工具")) + 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_output_dir=gr.Textbox(label=i18n("降噪结果输出文件夹"),value="output/denoise_opt") + denoise_info = gr.Textbox(label=i18n("语音降噪进程输出信息")) gr.Markdown(value=i18n("0c-中文批量离线ASR工具")) with gr.Row(): open_asr_button = gr.Button(i18n("开启离线批量ASR"), variant="primary",visible=True) @@ -740,6 +771,9 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: close_asr_button.click(close_asr, [], [asr_info,open_asr_button,close_asr_button]) open_slicer_button.click(open_slice, [slice_inp_path,slice_opt_root,threshold,min_length,min_interval,hop_size,max_sil_kept,_max,alpha,n_process], [slicer_info,open_slicer_button,close_slicer_button]) close_slicer_button.click(close_slice, [], [slicer_info,open_slicer_button,close_slicer_button]) + open_denoise_button.click(open_denoise, [denoise_input_dir,denoise_output_dir], [denoise_info,open_denoise_button,close_denoise_button]) + close_denoise_button.click(close_denoise, [], [denoise_info,open_denoise_button,close_denoise_button]) + with gr.TabItem(i18n("1-GPT-SoVITS-TTS")): with gr.Row(): exp_name = gr.Textbox(label=i18n("*实验/模型名"), value="xxx", interactive=True)