소스 검색

rework-disable-autolaunch

w-e-w 2 년 전
부모
커밋
1411a6e74b
2개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 0
      modules/launch_utils.py
  2. 1 4
      webui.py

+ 1 - 0
modules/launch_utils.py

@@ -247,6 +247,7 @@ def prepare_environment():
     try:
     try:
         # the existance of this file is a signal to webui.sh/bat that webui needs to be restarted when it stops execution
         # the existance of this file is a signal to webui.sh/bat that webui needs to be restarted when it stops execution
         os.remove(os.path.join(script_path, "tmp", "restart"))
         os.remove(os.path.join(script_path, "tmp", "restart"))
+        os.environ.setdefault('SD_WEBUI_DISABLE_AUTOLAUNCH', '1')
     except OSError:
     except OSError:
         pass
         pass
 
 

+ 1 - 4
webui.py

@@ -396,7 +396,7 @@ def webui():
             ssl_verify=cmd_opts.disable_tls_verify,
             ssl_verify=cmd_opts.disable_tls_verify,
             debug=cmd_opts.gradio_debug,
             debug=cmd_opts.gradio_debug,
             auth=gradio_auth_creds,
             auth=gradio_auth_creds,
-            inbrowser=cmd_opts.autolaunch,
+            inbrowser=cmd_opts.autolaunch and os.getenv('SD_WEBUI_DISABLE_AUTOLAUNCH') != '1',
             prevent_thread_lock=True,
             prevent_thread_lock=True,
             allowed_paths=cmd_opts.gradio_allowed_path,
             allowed_paths=cmd_opts.gradio_allowed_path,
             app_kwargs={
             app_kwargs={
@@ -407,9 +407,6 @@ def webui():
         if cmd_opts.add_stop_route:
         if cmd_opts.add_stop_route:
             app.add_route("/_stop", stop_route, methods=["POST"])
             app.add_route("/_stop", stop_route, methods=["POST"])
 
 
-        # after initial launch, disable --autolaunch for subsequent restarts
-        cmd_opts.autolaunch = False
-
         startup_timer.record("gradio launch")
         startup_timer.record("gradio launch")
 
 
         # gradio uses a very open CORS policy via app.user_middleware, which makes it possible for
         # gradio uses a very open CORS policy via app.user_middleware, which makes it possible for