From 91ad53cd948041812cfdc412b1ec391264620530 Mon Sep 17 00:00:00 2001 From: Siavosh Kasravi Date: Wed, 5 Jun 2024 11:12:21 +0330 Subject: [PATCH 1/2] Enhancement - using uvicorn.run() instead of os.system() --- scripts/check_modules.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index 35cdc6dc..d1392bec 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -369,9 +369,9 @@ def launch_uvicorn(): setup_amd_environment() print("\nLaunching uvicorn\n") - os.system( - f'python -m uvicorn main:server_api --app-dir "{os.environ["SD_UI_PATH"]}" --port {listen_port} --host {bind_ip} --log-level error' - ) + + from uvicorn import run + run("main:server_api", port=listen_port, log_level="error", app_dir=os.environ["SD_UI_PATH"], host=bind_ip, access_log=False) ### Start From 969751a19531a2124f492f43bfc8307ddc76940c Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 6 Jun 2024 17:50:41 +0530 Subject: [PATCH 2/2] Use uvicorn.run since it's clearer to read --- scripts/check_modules.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index d1392bec..9f31da2c 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -370,8 +370,8 @@ def launch_uvicorn(): print("\nLaunching uvicorn\n") - from uvicorn import run - run("main:server_api", port=listen_port, log_level="error", app_dir=os.environ["SD_UI_PATH"], host=bind_ip, access_log=False) + import uvicorn + uvicorn.run("main:server_api", port=listen_port, log_level="error", app_dir=os.environ["SD_UI_PATH"], host=bind_ip, access_log=False) ### Start