Maria
commited on
Commit
·
62fabfd
1
Parent(s):
73270ee
hw6
Browse files
infer.py
CHANGED
@@ -38,7 +38,7 @@ LoRA_path = 'new_model'
|
|
38 |
CONTROLNET_MODE = {
|
39 |
"Canny Edge Detection" : "lllyasviel/control_v11p_sd15_canny",
|
40 |
"Pixel to Pixel": "lllyasviel/control_v11e_sd15_ip2p",
|
41 |
-
"HED edge detection (soft edge)" : "lllyasviel/
|
42 |
"Midas depth estimation" : "lllyasviel/control_v11f1p_sd15_depth",
|
43 |
"Surface Normal Estimation" : "lllyasviel/control_v11p_sd15_normalbae",
|
44 |
"Scribble-Based Generation" : "lllyasviel/control_v11p_sd15_scribble",
|
@@ -138,7 +138,7 @@ def prepare_controlnet_image(controlnet_image, mode):
|
|
138 |
image = Image.fromarray(image)
|
139 |
|
140 |
elif mode == "Pixel to Pixel":
|
141 |
-
image = controlnet_image.convert('RGB')
|
142 |
|
143 |
elif mode == "HED edge detection (soft edge)":
|
144 |
processor = HEDdetector.from_pretrained('lllyasviel/Annotators')
|
@@ -146,7 +146,7 @@ def prepare_controlnet_image(controlnet_image, mode):
|
|
146 |
|
147 |
elif mode == "Midas depth estimation":
|
148 |
depth_estimator = pipeline('depth-estimation')
|
149 |
-
image = depth_estimator(controlnet_image)['depth']
|
150 |
image = np.array(image)
|
151 |
image = image[:, :, None]
|
152 |
image = np.concatenate([image, image, image], axis=2)
|
|
|
38 |
CONTROLNET_MODE = {
|
39 |
"Canny Edge Detection" : "lllyasviel/control_v11p_sd15_canny",
|
40 |
"Pixel to Pixel": "lllyasviel/control_v11e_sd15_ip2p",
|
41 |
+
"HED edge detection (soft edge)" : "lllyasviel/control_v11p_sd15_softedge",
|
42 |
"Midas depth estimation" : "lllyasviel/control_v11f1p_sd15_depth",
|
43 |
"Surface Normal Estimation" : "lllyasviel/control_v11p_sd15_normalbae",
|
44 |
"Scribble-Based Generation" : "lllyasviel/control_v11p_sd15_scribble",
|
|
|
138 |
image = Image.fromarray(image)
|
139 |
|
140 |
elif mode == "Pixel to Pixel":
|
141 |
+
image = Image.fromarray(controlnet_image).convert('RGB')
|
142 |
|
143 |
elif mode == "HED edge detection (soft edge)":
|
144 |
processor = HEDdetector.from_pretrained('lllyasviel/Annotators')
|
|
|
146 |
|
147 |
elif mode == "Midas depth estimation":
|
148 |
depth_estimator = pipeline('depth-estimation')
|
149 |
+
image = depth_estimator(Image.fromarray(controlnet_image))['depth']
|
150 |
image = np.array(image)
|
151 |
image = image[:, :, None]
|
152 |
image = np.concatenate([image, image, image], axis=2)
|