From eada712b23bda44e25cfe5a400895bd03ae6ed6a Mon Sep 17 00:00:00 2001 From: XXXXRT666 Date: Sat, 3 Aug 2024 14:03:40 +0800 Subject: [PATCH] remove useless code chores chores chores . --- GPT_SoVITS/inference_webui.py | 14 ++++++-------- webui.py | 13 ++++++++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/GPT_SoVITS/inference_webui.py b/GPT_SoVITS/inference_webui.py index 7764e3fa..a7e775e7 100644 --- a/GPT_SoVITS/inference_webui.py +++ b/GPT_SoVITS/inference_webui.py @@ -39,10 +39,6 @@ with open(f"./weight.json", 'r', encoding="utf-8") as file: "gpt_path", weight_data.get('GPT',{}).get(version,pretrained_gpt_name)) sovits_path = os.environ.get( "sovits_path", weight_data.get('SoVITS',{}).get(version,pretrained_sovits_name)) - -# if len(sys.argv[1]==2) or len(sys.argv[1])==5: -# gpt_path = pretrained_gpt_name -# sovits_path = pretrained_sovits_name # gpt_path = os.environ.get( # "gpt_path", pretrained_gpt_name @@ -599,10 +595,12 @@ def change_choices(): return {"choices": sorted(SoVITS_names, key=custom_sort_key), "__type__": "update"}, {"choices": sorted(GPT_names, key=custom_sort_key), "__type__": "update"} -SoVITS_weight_root = f"SoVITS_weights/{version}" -GPT_weight_root = f"GPT_weights/{version}" -os.makedirs(SoVITS_weight_root, exist_ok=True) -os.makedirs(GPT_weight_root, exist_ok=True) +SoVITS_weight_root="SoVITS_weights_v2" if version=='v2' else "SoVITS_weights" +GPT_weight_root="GPT_weights_v2" if version=='v2' else "GPT_weights" +os.makedirs("SoVITS_weights",exist_ok=True) +os.makedirs("GPT_weights",exist_ok=True) +os.makedirs("SoVITS_weights_v2",exist_ok=True) +os.makedirs("GPT_weights_v2",exist_ok=True) def get_weights_names(): diff --git a/webui.py b/webui.py index e3dbebcf..faebb784 100644 --- a/webui.py +++ b/webui.py @@ -1,6 +1,7 @@ import os,shutil,sys,pdb,re +if len(sys.argv)==1:sys.argv.append('v1') version="v2"if sys.argv[1]=="v2" else"v1" -language=sys.argv[-1] if sys.argv[-1]!='v2' and sys.argv[-1]!='v1' else 'auto' +language=sys.argv[-1] if len(sys.argv[-1])==5 else "auto" os.environ["version"]=version os.environ["language"]=language now_dir = os.getcwd() @@ -121,10 +122,12 @@ def get_weights_names(): for name in os.listdir(GPT_weight_root): if name.endswith(".ckpt"): GPT_names.append(name) return SoVITS_names,GPT_names -SoVITS_weight_root=f"SoVITS_weights/{version}" -GPT_weight_root=f"GPT_weights/{version}" -os.makedirs(SoVITS_weight_root,exist_ok=True) -os.makedirs(GPT_weight_root,exist_ok=True) +SoVITS_weight_root="SoVITS_weights_v2" if version=='v2' else "SoVITS_weights" +GPT_weight_root="GPT_weights_v2" if version=='v2' else "GPT_weights" +os.makedirs("SoVITS_weights",exist_ok=True) +os.makedirs("GPT_weights",exist_ok=True) +os.makedirs("SoVITS_weights_v2",exist_ok=True) +os.makedirs("GPT_weights_v2",exist_ok=True) SoVITS_names,GPT_names = get_weights_names() def custom_sort_key(s):