Spaces:
Running
Running
Create dev.py
Browse files
dev.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from diffusers.utils import load_image
|
2 |
+
|
3 |
+
def get_canny_filter(image):
|
4 |
+
image = load_image(image)
|
5 |
+
|
6 |
+
image = np.array(image)
|
7 |
+
|
8 |
+
low_threshold = 100
|
9 |
+
high_threshold = 200
|
10 |
+
|
11 |
+
image = cv2.Canny(image, low_threshold, high_threshold)
|
12 |
+
image = image[:, :, None]
|
13 |
+
image = np.concatenate([image, image, image], axis=2)
|
14 |
+
image = Image.fromarray(image)
|
15 |
+
return image
|