From 8d171bb044f578d4b9cc4911edfa05b20a01d373 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 2 Nov 2022 11:13:26 +1100 Subject: [PATCH] Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. --- backend/invoke_ai_web_server.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/invoke_ai_web_server.py b/backend/invoke_ai_web_server.py index 64304d395d..6dec3ae008 100644 --- a/backend/invoke_ai_web_server.py +++ b/backend/invoke_ai_web_server.py @@ -668,6 +668,15 @@ class InvokeAIWebServer: step_index = 1 nonlocal prior_variations + + # paste the inpainting image back onto the original + if "init_mask" in generation_parameters: + image = paste_image_into_bounding_box( + Image.open(init_img_path), + image, + **generation_parameters["bounding_box"], + ) + progress.set_current_status("Generation Complete") self.socketio.emit("progressUpdate", progress.to_formatted_dict()) @@ -756,14 +765,6 @@ class InvokeAIWebServer: self.socketio.emit("progressUpdate", progress.to_formatted_dict()) eventlet.sleep(0) - # paste the inpainting image back onto the original - if "init_mask" in generation_parameters: - image = paste_image_into_bounding_box( - Image.open(init_img_path), - image, - **generation_parameters["bounding_box"], - ) - # restore the stashed URLS and discard the paths, we are about to send the result to client if "init_img" in all_parameters: all_parameters["init_img"] = init_img_url