From f1de0be679cb84e7d7e804b65652a26d73b6c8f6 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Fri, 9 Dec 2022 17:50:33 +0530 Subject: [PATCH] Fix integration issues after the refactor --- scripts/on_sd_start.bat | 2 +- scripts/on_sd_start.sh | 2 +- ui/sd_internal/device_manager.py | 2 +- ui/sd_internal/runtime2.py | 9 +++++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/on_sd_start.bat b/scripts/on_sd_start.bat index d8981226..9bac3757 100644 --- a/scripts/on_sd_start.bat +++ b/scripts/on_sd_start.bat @@ -393,7 +393,7 @@ call python --version @if NOT DEFINED SD_UI_BIND_PORT set SD_UI_BIND_PORT=9000 @if NOT DEFINED SD_UI_BIND_IP set SD_UI_BIND_IP=0.0.0.0 -@uvicorn server:app --app-dir "%SD_UI_PATH%" --port %SD_UI_BIND_PORT% --host %SD_UI_BIND_IP% +@uvicorn server:server_api --app-dir "%SD_UI_PATH%" --port %SD_UI_BIND_PORT% --host %SD_UI_BIND_IP% @pause diff --git a/scripts/on_sd_start.sh b/scripts/on_sd_start.sh index 3e1c9c58..afb95295 100755 --- a/scripts/on_sd_start.sh +++ b/scripts/on_sd_start.sh @@ -322,6 +322,6 @@ cd .. export SD_UI_PATH=`pwd`/ui cd stable-diffusion -uvicorn server:app --app-dir "$SD_UI_PATH" --port ${SD_UI_BIND_PORT:-9000} --host ${SD_UI_BIND_IP:-0.0.0.0} +uvicorn server:server_api --app-dir "$SD_UI_PATH" --port ${SD_UI_BIND_PORT:-9000} --host ${SD_UI_BIND_IP:-0.0.0.0} read -p "Press any key to continue" diff --git a/ui/sd_internal/device_manager.py b/ui/sd_internal/device_manager.py index 4de6b265..c490a0c6 100644 --- a/ui/sd_internal/device_manager.py +++ b/ui/sd_internal/device_manager.py @@ -101,7 +101,7 @@ def device_init(context, device): context.device = device # Force full precision on 1660 and 1650 NVIDIA cards to avoid creating green images - if needs_to_force_full_precision(context.device_name): + if needs_to_force_full_precision(context): print(f'forcing full precision on this GPU, to avoid green images. GPU detected: {context.device_name}') # Apply force_full_precision now before models are loaded. context.precision = 'full' diff --git a/ui/sd_internal/runtime2.py b/ui/sd_internal/runtime2.py index 080180a4..0fcf8eb7 100644 --- a/ui/sd_internal/runtime2.py +++ b/ui/sd_internal/runtime2.py @@ -83,7 +83,12 @@ def _make_images_internal(req: Request, data_queue: queue.Queue, task_temp_image save_images(req, images) - return Response(req, images=construct_response(req, images)) + res = Response(req, images=construct_response(req, images)) + res = res.json() + data_queue.put(json.dumps(res)) + print('Task completed') + + return res def generate_images(req: Request, data_queue: queue.Queue, task_temp_images: list, step_callback): thread_data.temp_images.clear() @@ -91,7 +96,7 @@ def generate_images(req: Request, data_queue: queue.Queue, task_temp_images: lis image_generator.on_image_step = make_step_callback(req, data_queue, task_temp_images, step_callback) try: - images = image_generator.make_image(context=thread_data, args=get_mk_img_args(req)) + images = image_generator.make_images(context=thread_data, args=get_mk_img_args(req)) user_stopped = False except UserInitiatedStop: images = []