修正了对gr3的支持

This commit is contained in:
XTer 2024-03-21 19:57:10 +08:00
parent 3d65166b35
commit 948fedbf1d
2 changed files with 23 additions and 7 deletions

View File

@ -17,8 +17,9 @@ from srt_utils import (
port = 8991 port = 8991
if len(sys.argv) > 1: if len(sys.argv) > 2:
port = int(sys.argv[1]) port = int(sys.argv[1])
is_share = eval(sys.argv[2])
from i18n.i18n import I18nAuto from i18n.i18n import I18nAuto
@ -376,4 +377,19 @@ with gr.Blocks() as app:
[save_folder, character], [save_folder, character],
[character_warning], [character_warning],
) )
app.launch(inbrowser=True, server_port=port, debug=True) if gr.__version__.split(".")[0] == "4":
app.launch(
server_name="0.0.0.0",
inbrowser=True,
share=is_share,
server_port=port,
quiet=True,
)
else:
app.queue(concurrency_count=511, max_size=1022).launch(
server_name="0.0.0.0",
inbrowser=True,
share=is_share,
server_port=port,
quiet=True,
)

View File

@ -166,7 +166,7 @@ def change_label(if_label,path_list):
def change_srt_slicer(if_srt_slicer): def change_srt_slicer(if_srt_slicer):
global p_srt_slicer global p_srt_slicer
if(if_srt_slicer==True and p_srt_slicer==None): if(if_srt_slicer==True and p_srt_slicer==None):
cmd = '"%s" tools/srt_slicer/webui.py %s'%(python_exec,webui_port_srt_slicer) cmd = '"%s" tools/srt_slicer/webui.py %s %s'%(python_exec,webui_port_srt_slicer,is_share)
yield i18n("SRT切割工具WebUI已开启") yield i18n("SRT切割工具WebUI已开启")
print(cmd) print(cmd)
p_srt_slicer = Popen(cmd, shell=True) p_srt_slicer = Popen(cmd, shell=True)