47
webui.py
47
webui.py
@@ -52,12 +52,9 @@ from subprocess import Popen
|
||||
import signal
|
||||
from config import python_exec,infer_device,is_half,exp_root,webui_port_main,webui_port_infer_tts,webui_port_uvr5,webui_port_subfix,is_share
|
||||
from tools.i18n.i18n import I18nAuto, scan_language_list
|
||||
language=sys.argv[-1] if sys.argv[-1] in scan_language_list() else "auto"
|
||||
language=sys.argv[-1] if sys.argv[-1] in scan_language_list() else "Auto"
|
||||
os.environ["language"]=language
|
||||
if language != 'auto':
|
||||
i18n = I18nAuto(language=language)
|
||||
else:
|
||||
i18n = I18nAuto()
|
||||
i18n = I18nAuto(language=language)
|
||||
from scipy.io import wavfile
|
||||
from tools.my_utils import load_audio
|
||||
from multiprocessing import cpu_count
|
||||
@@ -440,7 +437,7 @@ def open1a(inp_text,inp_wav_dir,exp_name,gpu_numbers,bert_pretrained_dir):
|
||||
global ps1a
|
||||
inp_text = my_utils.clean_path(inp_text)
|
||||
inp_wav_dir = my_utils.clean_path(inp_wav_dir)
|
||||
check_for_exists([inp_text,inp_wav_dir])
|
||||
check_for_exists([inp_text,inp_wav_dir], is_dataset_processing=True)
|
||||
if (ps1a == []):
|
||||
opt_dir="%s/%s"%(exp_root,exp_name)
|
||||
config={
|
||||
@@ -502,7 +499,7 @@ def open1b(inp_text,inp_wav_dir,exp_name,gpu_numbers,ssl_pretrained_dir):
|
||||
global ps1b
|
||||
inp_text = my_utils.clean_path(inp_text)
|
||||
inp_wav_dir = my_utils.clean_path(inp_wav_dir)
|
||||
check_for_exists([inp_text,inp_wav_dir])
|
||||
check_for_exists([inp_text,inp_wav_dir], is_dataset_processing=True)
|
||||
if (ps1b == []):
|
||||
config={
|
||||
"inp_text":inp_text,
|
||||
@@ -550,7 +547,7 @@ ps1c=[]
|
||||
def open1c(inp_text,exp_name,gpu_numbers,pretrained_s2G_path):
|
||||
global ps1c
|
||||
inp_text = my_utils.clean_path(inp_text)
|
||||
check_for_exists([inp_text])
|
||||
check_for_exists([inp_text,''], is_dataset_processing=True)
|
||||
if (ps1c == []):
|
||||
opt_dir="%s/%s"%(exp_root,exp_name)
|
||||
config={
|
||||
@@ -746,8 +743,8 @@ def switch_version(version_):
|
||||
gr.Warning(i18n(f'未下载{version.upper()}模型'))
|
||||
return {'__type__':'update', 'value':pretrained_sovits_name[-int(version[-1])+2]}, {'__type__':'update', 'value':pretrained_sovits_name[-int(version[-1])+2].replace("s2G","s2D")}, {'__type__':'update', 'value':pretrained_gpt_name[-int(version[-1])+2]}, {'__type__':'update', 'value':pretrained_gpt_name[-int(version[-1])+2]}, {'__type__':'update', 'value':pretrained_sovits_name[-int(version[-1])+2]}
|
||||
|
||||
def check_for_exists(file_list=[],is_train=False):
|
||||
_=[]
|
||||
def check_for_exists(file_list=None,is_train=False,is_dataset_processing=False):
|
||||
missing_files=[]
|
||||
if is_train == True and file_list:
|
||||
file_list.append(os.path.join(file_list[0],'2-name2text.txt'))
|
||||
file_list.append(os.path.join(file_list[0],'3-bert'))
|
||||
@@ -756,24 +753,28 @@ def check_for_exists(file_list=[],is_train=False):
|
||||
file_list.append(os.path.join(file_list[0],'6-name2semantic.tsv'))
|
||||
for file in file_list:
|
||||
if os.path.exists(file):pass
|
||||
else:_.append(file)
|
||||
if _:
|
||||
else:missing_files.append(file)
|
||||
if missing_files:
|
||||
if is_train:
|
||||
for i in _:
|
||||
if i != '':
|
||||
gr.Warning(i)
|
||||
for missing_file in missing_files:
|
||||
if missing_file != '':
|
||||
gr.Warning(missing_file)
|
||||
gr.Warning(i18n('以下文件或文件夹不存在:'))
|
||||
else:
|
||||
if len(_) == 1:
|
||||
if _[0]:
|
||||
gr.Warning(i)
|
||||
gr.Warning(i18n('文件或文件夹不存在:'))
|
||||
for missing_file in missing_files:
|
||||
if missing_file != '':
|
||||
gr.Warning(missing_file)
|
||||
if file_list[-1]==[''] and is_dataset_processing:
|
||||
pass
|
||||
else:
|
||||
for i in _:
|
||||
if i != '':
|
||||
gr.Warning(i)
|
||||
gr.Warning(i18n('以下文件或文件夹不存在:'))
|
||||
|
||||
if os.path.exists('GPT_SoVITS/text/G2PWModel'):...
|
||||
else:
|
||||
cmd = '"%s" GPT_SoVITS/download.py'%python_exec
|
||||
p = Popen(cmd, shell=True)
|
||||
p.wait()
|
||||
|
||||
with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
||||
gr.Markdown(
|
||||
value=
|
||||
@@ -1009,4 +1010,4 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
||||
share=is_share,
|
||||
server_port=webui_port_main,
|
||||
quiet=True,
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user