mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-09-02 13:19:53 +08:00
新增本地模式配置,启用后仅允许本机访问
在`config.py`新增`local_mode`本地模式开关,默认关闭,启用后服务仅限本机访问(127.0.0.1或localhost),可以提升开发调试时的安全性。
This commit is contained in:
parent
7cb00eac17
commit
e58426d23b
@ -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,
|
||||
|
@ -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),
|
||||
|
@ -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,
|
||||
|
5
webui.py
5
webui.py
@ -389,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},
|
||||
@ -413,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},
|
||||
@ -451,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},
|
||||
|
Loading…
x
Reference in New Issue
Block a user