Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ import random
|
|
14 |
|
15 |
os.system("pip install -e ./controlnet_aux")
|
16 |
|
17 |
-
from controlnet_aux import OpenposeDetector
|
18 |
from depth_anything_v2.dpt import DepthAnythingV2
|
19 |
|
20 |
from huggingface_hub import hf_hub_download
|
@@ -113,7 +113,7 @@ strength_mapping = {
|
|
113 |
"pose": 1.0,
|
114 |
}
|
115 |
|
116 |
-
canny = CannyDetector()
|
117 |
open_pose = OpenposeDetector.from_pretrained("lllyasviel/Annotators")
|
118 |
|
119 |
torch.backends.cuda.matmul.allow_tf32 = True
|
@@ -139,9 +139,13 @@ def extract_openpose(img):
|
|
139 |
processed_image_open_pose = open_pose(img, hand_and_face=True)
|
140 |
return processed_image_open_pose
|
141 |
|
142 |
-
def extract_canny(
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
145 |
|
146 |
def apply_gaussian_blur(image, kernel_size=(21, 21)):
|
147 |
image = convert_from_image_to_cv2(image)
|
|
|
14 |
|
15 |
os.system("pip install -e ./controlnet_aux")
|
16 |
|
17 |
+
from controlnet_aux import OpenposeDetector #, CannyDetector
|
18 |
from depth_anything_v2.dpt import DepthAnythingV2
|
19 |
|
20 |
from huggingface_hub import hf_hub_download
|
|
|
113 |
"pose": 1.0,
|
114 |
}
|
115 |
|
116 |
+
# canny = CannyDetector()
|
117 |
open_pose = OpenposeDetector.from_pretrained("lllyasviel/Annotators")
|
118 |
|
119 |
torch.backends.cuda.matmul.allow_tf32 = True
|
|
|
139 |
processed_image_open_pose = open_pose(img, hand_and_face=True)
|
140 |
return processed_image_open_pose
|
141 |
|
142 |
+
def extract_canny(input_image):
|
143 |
+
image = np.array(input_image)
|
144 |
+
image = cv2.Canny(image, self.low_threshold, self.high_threshold)
|
145 |
+
image = image[:, :, None]
|
146 |
+
image = np.concatenate([image, image, image], axis=2)
|
147 |
+
canny_image = Image.fromarray(image)
|
148 |
+
return canny_image
|
149 |
|
150 |
def apply_gaussian_blur(image, kernel_size=(21, 21)):
|
151 |
image = convert_from_image_to_cv2(image)
|