From af6f5d842bf033242e5674e68e19b958ba0ebbd2 Mon Sep 17 00:00:00 2001 From: Ean Garvey Date: Mon, 4 Dec 2023 06:56:43 -0600 Subject: [PATCH] img2img ui tweaks --- apps/stable_diffusion/web/ui/img2img_ui.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/stable_diffusion/web/ui/img2img_ui.py b/apps/stable_diffusion/web/ui/img2img_ui.py index 9eb55f38c4..2d042c646c 100644 --- a/apps/stable_diffusion/web/ui/img2img_ui.py +++ b/apps/stable_diffusion/web/ui/img2img_ui.py @@ -85,7 +85,6 @@ def img2img_inf( from apps.stable_diffusion.src.pipelines.pipeline_shark_stable_diffusion_utils import ( SD_STATE_CANCEL, ) - args.prompts = [prompt] args.negative_prompts = [negative_prompt] args.guidance_scale = guidance_scale @@ -98,20 +97,21 @@ def img2img_inf( for i, stencil in enumerate(stencils): if images[i] is None and stencil is not None: - return None, "A stencil must have an Image input" + return if images[i] is not None: if isinstance(images[i], dict): - images[i] = images[i]["layers"][0] + images[i] = images[i]["composite"] images[i] = images[i].convert("RGB") - if image_dict is None: + if image_dict is None and images[0] is None: return None, "An Initial Image is required" - # if use_stencil == "scribble": - # image = image_dict["mask"].convert("RGB") if isinstance(image_dict, PIL.Image.Image): image = image_dict.convert("RGB") - else: + elif image_dict: image = image_dict["image"].convert("RGB") + else: + #TODO: enable t2i + controlnets + image = None # set ckpt_loc and hf_model_id. args.ckpt_loc = "" @@ -143,9 +143,8 @@ def img2img_inf( if stencil is not None: stencil_count += 1 if stencil_count > 0: - args.scheduler = "DDIM" args.hf_model_id = "runwayml/stable-diffusion-v1-5" - # image, width, height = resize_stencil(image) + image, width, height = resize_stencil(image) elif "Shark" in args.scheduler: print( f"Shark schedulers are not supported. Switching to EulerDiscrete "