diff options
author | catalpaaa <caojingzifang@gmail.com> | 2023-06-28 10:15:01 +0000 |
---|---|---|
committer | catalpaaa <caojingzifang@gmail.com> | 2023-06-28 10:15:01 +0000 |
commit | 24d4475bdb623b321bc3fdf7205ae4f3221b6dd5 (patch) | |
tree | 74b83586bea86a0283ae75354e2666f950d6a492 | |
parent | 394ffa7b0a7fff3ec484bcd084e673a8b301ccc8 (diff) | |
download | stable-diffusion-webui-gfx803-24d4475bdb623b321bc3fdf7205ae4f3221b6dd5.tar.gz stable-diffusion-webui-gfx803-24d4475bdb623b321bc3fdf7205ae4f3221b6dd5.tar.bz2 stable-diffusion-webui-gfx803-24d4475bdb623b321bc3fdf7205ae4f3221b6dd5.zip |
fixing --subpath on newer gradio version
-rw-r--r-- | webui.py | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -359,7 +359,11 @@ def api_only(): modules.script_callbacks.app_started_callback(None, app)
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 stop_route(request):
@@ -403,6 +407,7 @@ def webui(): "docs_url": "/docs",
"redoc_url": "/redoc",
},
+ root_path = f"/{cmd_opts.subpath}",
)
if cmd_opts.add_stop_route:
app.add_route("/_stop", stop_route, methods=["POST"])
@@ -436,11 +441,6 @@ def webui(): timer.startup_record = startup_timer.dump()
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:
while True:
server_command = shared.state.wait_for_server_command(timeout=5)
|