Spaces:
Runtime error
Runtime error
Update diffusion_webui/diffusion_models/controlnet/controlnet_inpaint/controlnet_inpaint_canny.py
Browse files
diffusion_webui/diffusion_models/controlnet/controlnet_inpaint/controlnet_inpaint_canny.py
CHANGED
|
@@ -39,6 +39,12 @@ class StableDiffusionControlNetInpaintCannyGenerator:
|
|
| 39 |
self.pipe.enable_xformers_memory_efficient_attention()
|
| 40 |
|
| 41 |
return self.pipe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
def controlnet_canny_inpaint(
|
| 44 |
self,
|
|
@@ -70,12 +76,10 @@ class StableDiffusionControlNetInpaintCannyGenerator:
|
|
| 70 |
):
|
| 71 |
|
| 72 |
normal_image = image_path["image"].convert("RGB").resize((512, 512))
|
| 73 |
-
normal_image = np.array(normal_image)
|
| 74 |
-
normal_image = Image.fromarray(normal_image)
|
| 75 |
-
|
| 76 |
mask_image = image_path["mask"].convert("RGB").resize((512, 512))
|
| 77 |
-
|
| 78 |
-
|
|
|
|
| 79 |
|
| 80 |
control_image = self.controlnet_canny_inpaint(image_path=image_path)
|
| 81 |
pipe = self.load_model(
|
|
|
|
| 39 |
self.pipe.enable_xformers_memory_efficient_attention()
|
| 40 |
|
| 41 |
return self.pipe
|
| 42 |
+
|
| 43 |
+
def load_img(self, image_path):
|
| 44 |
+
image = image_path["image"].convert("RGB").resize((512, 512))
|
| 45 |
+
image = np.array(image)
|
| 46 |
+
image = Image.fromarray(image)
|
| 47 |
+
return image
|
| 48 |
|
| 49 |
def controlnet_canny_inpaint(
|
| 50 |
self,
|
|
|
|
| 76 |
):
|
| 77 |
|
| 78 |
normal_image = image_path["image"].convert("RGB").resize((512, 512))
|
|
|
|
|
|
|
|
|
|
| 79 |
mask_image = image_path["mask"].convert("RGB").resize((512, 512))
|
| 80 |
+
|
| 81 |
+
normal_image = self.load_img(image_path=image_path)
|
| 82 |
+
mask_image = self.load_img(image_path=image_path)
|
| 83 |
|
| 84 |
control_image = self.controlnet_canny_inpaint(image_path=image_path)
|
| 85 |
pipe = self.load_model(
|