Merge 9ebae35a7d03aefd55e8e5509bc66c910fc4a19a into 13055fa56994e75a7152c176047c56c62bbeede4

This commit is contained in:
Karasukaigan 2025-05-07 21:31:12 +08:00 committed by GitHub
commit c98eb734ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 20 additions and 6 deletions

View File

@ -287,8 +287,9 @@ class TTS_Config:
configs: dict = self._load_configs(self.configs_path)
assert isinstance(configs, dict)
version = configs.get("version", "v2").lower()
assert version in ["v1", "v2", "v3", "v4"]
version = "v2"
if "custom" in configs and configs["custom"]["version"].lower() in ["v1", "v2", "v3", "v4"]:
version = configs["custom"]["version"].lower()
self.default_configs[version] = configs.get(version, self.default_configs[version])
self.configs: dict = configs.get("custom", deepcopy(self.default_configs[version]))

View File

@ -91,6 +91,8 @@ infer_ttswebui = os.environ.get("infer_ttswebui", 9872)
infer_ttswebui = int(infer_ttswebui)
is_share = os.environ.get("is_share", "False")
is_share = eval(is_share)
local_mode = os.environ.get("local_mode", "False")
local_mode = eval(local_mode)
if "_CUDA_VISIBLE_DEVICES" in os.environ:
os.environ["CUDA_VISIBLE_DEVICES"] = os.environ["_CUDA_VISIBLE_DEVICES"]
is_half = eval(os.environ.get("is_half", "True")) and torch.cuda.is_available()
@ -1273,7 +1275,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
if __name__ == "__main__":
app.queue().launch( # concurrency_count=511, max_size=1022
server_name="0.0.0.0",
server_name="127.0.0.1" if local_mode else "0.0.0.0",
inbrowser=True,
share=is_share,
server_port=infer_ttswebui,

View File

@ -30,6 +30,9 @@ webui_port_subfix = 9871
api_port = 9880
# 设置为True可启用本地模式该模式只允许本机访问避免出现潜在安全问题。默认为False。
local_mode = False
if infer_device == "cuda":
gpu_name = torch.cuda.get_device_name(0)
if (

View File

@ -298,6 +298,7 @@ if __name__ == "__main__":
parser.add_argument("--json_key_text", default="text", help="the text key name in json, Default: text")
parser.add_argument("--json_key_path", default="wav_path", help="the path key name in json, Default: wav_path")
parser.add_argument("--g_batch", default=10, help="max number g_batch wav to display, Default: 10")
parser.add_argument("--local_mode", action="store_true", help="enable local mode (bind to 127.0.0.1)")
args = parser.parse_args()
@ -407,7 +408,7 @@ if __name__ == "__main__":
)
demo.launch(
server_name="0.0.0.0",
server_name="127.0.0.1" if args.local_mode else "0.0.0.0",
inbrowser=True,
# quiet=True,
share=eval(args.is_share),

View File

@ -32,6 +32,7 @@ device = sys.argv[1]
is_half = eval(sys.argv[2])
webui_port_uvr5 = int(sys.argv[3])
is_share = eval(sys.argv[4])
local_mode = sys.argv[5].lower() == 'true' if len(sys.argv) > 5 else False
def html_left(text, label="p"):
@ -220,7 +221,7 @@ with gr.Blocks(title="UVR5 WebUI") as app:
api_name="uvr_convert",
)
app.queue().launch( # concurrency_count=511, max_size=1022
server_name="0.0.0.0",
server_name="127.0.0.1" if local_mode else "0.0.0.0",
inbrowser=True,
share=is_share,
server_port=webui_port_uvr5,

View File

@ -74,6 +74,7 @@ from config import (
webui_port_main,
webui_port_subfix,
webui_port_uvr5,
local_mode,
)
from tools import my_utils
from tools.i18n.i18n import I18nAuto, scan_language_list
@ -388,6 +389,8 @@ def change_label(path_list):
webui_port_subfix,
is_share,
)
if local_mode:
cmd += " --local_mode"
yield (
process_info(process_name_subfix, "opened"),
{"__type__": "update", "visible": False},
@ -412,6 +415,8 @@ def change_uvr5():
global p_uvr5
if p_uvr5 is None:
cmd = '"%s" tools/uvr5/webui.py "%s" %s %s %s' % (python_exec, infer_device, is_half, webui_port_uvr5, is_share)
if local_mode:
cmd += " True"
yield (
process_info(process_name_uvr5, "opened"),
{"__type__": "update", "visible": False},
@ -450,6 +455,7 @@ def change_tts_inference(bert_path, cnhubert_base_path, gpu_number, gpt_path, so
os.environ["is_half"] = str(is_half)
os.environ["infer_ttswebui"] = str(webui_port_infer_tts)
os.environ["is_share"] = str(is_share)
os.environ["local_mode"] = str(local_mode)
yield (
process_info(process_name_tts, "opened"),
{"__type__": "update", "visible": False},
@ -1955,7 +1961,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
gr.Markdown(value=i18n("施工中,请静候佳音"))
app.queue().launch( # concurrency_count=511, max_size=1022
server_name="0.0.0.0",
server_name="127.0.0.1" if local_mode else "0.0.0.0",
inbrowser=True,
share=is_share,
server_port=webui_port_main,