diff --git a/config.py b/config.py index 5f90c5cd..fe0bf4d1 100644 --- a/config.py +++ b/config.py @@ -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 ( diff --git a/webui.py b/webui.py index cddbb029..edaeafe8 100644 --- a/webui.py +++ b/webui.py @@ -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 @@ -1955,7 +1956,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,