From 71edcd6ab0ef1de0794a83c8f106ceb91b565ce4 Mon Sep 17 00:00:00 2001 From: starylan Date: Sat, 18 May 2024 23:27:41 +0800 Subject: [PATCH] add feedback --- webui.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/webui.py b/webui.py index 17032be1..51b97771 100644 --- a/webui.py +++ b/webui.py @@ -419,7 +419,10 @@ def open1a(inp_text,inp_wav_dir,exp_name,gpu_numbers,bert_pretrained_dir): with open(path_text, "w", encoding="utf8") as f: f.write("\n".join(opt) + "\n") ps1a=[] - yield "文本进程结束",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + if len(opt) > 0: + yield "文本进程成功", {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} + else: + yield "文本进程失败", {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} else: yield "已有正在进行的文本任务,需先终止才能开启下一次任务", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} @@ -579,12 +582,13 @@ def open1abc(inp_text,inp_wav_dir,exp_name,gpu_numbers1a,gpu_numbers1Ba,gpu_numb opt = [] for i_part in range(all_parts):#txt_path="%s/2-name2text-%s.txt"%(opt_dir,i_part) txt_path = "%s/2-name2text-%s.txt" % (opt_dir, i_part) - with open(txt_path, "r",encoding="utf8") as f: - opt += f.read().strip("\n").split("\n") - os.remove(txt_path) + if os.path.exists(txt_path): + with open(txt_path, "r",encoding="utf8") as f: + opt += f.read().strip("\n").split("\n") + os.remove(txt_path) with open(path_text, "w",encoding="utf8") as f: f.write("\n".join(opt) + "\n") - + assert len(opt) > 0, "1Aa-文本获取进程失败" yield "进度:1a-done", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} ps1abc=[] #############################1b