lj1995 commited on
Commit
c48a417
·
verified ·
1 Parent(s): 6886b06

Update inference_webui.py

Browse files
Files changed (1) hide show
  1. inference_webui.py +11 -4
inference_webui.py CHANGED
@@ -84,12 +84,12 @@ from module.mel_processing import spectrogram_torch
84
  from module.models import SynthesizerTrn
85
  from text import cleaned_text_to_sequence
86
  from text.cleaner import clean_text
87
- from tools.i18n.i18n import I18nAuto, scan_language_list
88
  from tools.my_utils import load_audio
89
 
90
  # language=os.environ.get("language","Auto")
91
  # language=sys.argv[-1] if sys.argv[-1] in scan_language_list() else language
92
- i18n = I18nAuto(language="Auto")
93
 
94
  # os.environ['PYTORCH_ENABLE_MPS_FALLBACK'] = '1' # 确保直接启动推理UI时也能够设置。
95
 
@@ -100,6 +100,13 @@ else:
100
  device = "cpu"
101
  is_half = False
102
 
 
 
 
 
 
 
 
103
  dict_language_v1 = {
104
  i18n("中文"): "all_zh", # 全部按中文识别
105
  i18n("英文"): "en", # 全部按英文识别#######不变
@@ -811,7 +818,7 @@ with gr.Blocks(
811
  text = gr.Textbox(label=i18n("需要合成的文本"), value="", lines=26, max_lines=26)
812
  with gr.Column():
813
  text_language = gr.Dropdown(
814
- label=i18n("需要合成的语种") + i18n(".限制范围越小判别效果越好。"),
815
  choices=list(dict_language.keys()),
816
  value=i18n("中文"),
817
  )
@@ -902,5 +909,5 @@ if __name__ == "__main__":
902
  server_name="0.0.0.0",
903
  inbrowser=True,
904
  show_api=False,
905
- allowed_paths=["/"],
906
  )
 
84
  from module.models import SynthesizerTrn
85
  from text import cleaned_text_to_sequence
86
  from text.cleaner import clean_text
87
+ # from tools.i18n.i18n import I18nAuto, scan_language_list
88
  from tools.my_utils import load_audio
89
 
90
  # language=os.environ.get("language","Auto")
91
  # language=sys.argv[-1] if sys.argv[-1] in scan_language_list() else language
92
+ # i18n = I18nAuto(language="Auto")
93
 
94
  # os.environ['PYTORCH_ENABLE_MPS_FALLBACK'] = '1' # 确保直接启动推理UI时也能够设置。
95
 
 
100
  device = "cpu"
101
  is_half = False
102
 
103
+ i18n_dict={}
104
+ json_root="tools/i18n/locale"
105
+ for name in os.listdir(json_root):
106
+ with open("%s/%s"%(json_root,name),"r")as f:
107
+ data=json.loads(f.read())
108
+ i18n_dict[name.split(".json")[0].replace("_","-")]=data
109
+ i18n=gr.I18n(**i18n_dict)
110
  dict_language_v1 = {
111
  i18n("中文"): "all_zh", # 全部按中文识别
112
  i18n("英文"): "en", # 全部按英文识别#######不变
 
818
  text = gr.Textbox(label=i18n("需要合成的文本"), value="", lines=26, max_lines=26)
819
  with gr.Column():
820
  text_language = gr.Dropdown(
821
+ label=i18n("需要合成的语种。限制范围越小判别效果越好。"),
822
  choices=list(dict_language.keys()),
823
  value=i18n("中文"),
824
  )
 
909
  server_name="0.0.0.0",
910
  inbrowser=True,
911
  show_api=False,
912
+ allowed_paths=["/"],i18n=i18n
913
  )