Merge pull request #11478 from catalpaaa/subpath
Fixing --subpath on newer gradio version
This commit is contained in:
commit
211c3398f6
12
webui.py
12
webui.py
@ -370,7 +370,11 @@ def api_only():
|
|||||||
modules.script_callbacks.app_started_callback(None, app)
|
modules.script_callbacks.app_started_callback(None, app)
|
||||||
|
|
||||||
print(f"Startup time: {startup_timer.summary()}.")
|
print(f"Startup time: {startup_timer.summary()}.")
|
||||||
api.launch(server_name="0.0.0.0" if cmd_opts.listen else "127.0.0.1", port=cmd_opts.port if cmd_opts.port else 7861)
|
api.launch(
|
||||||
|
server_name="0.0.0.0" if cmd_opts.listen else "127.0.0.1",
|
||||||
|
port=cmd_opts.port if cmd_opts.port else 7861,
|
||||||
|
root_path = f"/{cmd_opts.subpath}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def webui():
|
def webui():
|
||||||
@ -409,6 +413,7 @@ def webui():
|
|||||||
"docs_url": "/docs",
|
"docs_url": "/docs",
|
||||||
"redoc_url": "/redoc",
|
"redoc_url": "/redoc",
|
||||||
},
|
},
|
||||||
|
root_path = f"/{cmd_opts.subpath}",
|
||||||
)
|
)
|
||||||
|
|
||||||
# after initial launch, disable --autolaunch for subsequent restarts
|
# after initial launch, disable --autolaunch for subsequent restarts
|
||||||
@ -440,11 +445,6 @@ def webui():
|
|||||||
timer.startup_record = startup_timer.dump()
|
timer.startup_record = startup_timer.dump()
|
||||||
print(f"Startup time: {startup_timer.summary()}.")
|
print(f"Startup time: {startup_timer.summary()}.")
|
||||||
|
|
||||||
if cmd_opts.subpath:
|
|
||||||
redirector = FastAPI()
|
|
||||||
redirector.get("/")
|
|
||||||
gradio.mount_gradio_app(redirector, shared.demo, path=f"/{cmd_opts.subpath}")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
server_command = shared.state.wait_for_server_command(timeout=5)
|
server_command = shared.state.wait_for_server_command(timeout=5)
|
||||||
|
Loading…
Reference in New Issue
Block a user