Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ from flax.training.common_utils import shard
|
|
7 |
from diffusers.utils import load_image
|
8 |
from PIL import Image
|
9 |
from diffusers import FlaxStableDiffusionControlNetPipeline, FlaxControlNetModel
|
10 |
-
|
11 |
|
12 |
def image_grid(imgs, rows, cols):
|
13 |
w, h = imgs[0].size
|
@@ -24,10 +24,14 @@ def create_key(seed=0):
|
|
24 |
rng = create_key(0)
|
25 |
|
26 |
|
27 |
-
def canny_filter(image):
|
28 |
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
def infer(prompts, negative_prompts, image):
|
33 |
|
|
|
7 |
from diffusers.utils import load_image
|
8 |
from PIL import Image
|
9 |
from diffusers import FlaxStableDiffusionControlNetPipeline, FlaxControlNetModel
|
10 |
+
import cv2
|
11 |
|
12 |
def image_grid(imgs, rows, cols):
|
13 |
w, h = imgs[0].size
|
|
|
24 |
rng = create_key(0)
|
25 |
|
26 |
|
|
|
27 |
|
28 |
+
|
29 |
+
def canny_filter(image):
|
30 |
+
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
31 |
+
|
32 |
+
blurred_image = cv2.GaussianBlur(gray_image, (5, 5), 0)
|
33 |
+
edges_image = cv2.Canny(blurred_image, 50, 150)
|
34 |
+
return edges_image
|
35 |
|
36 |
def infer(prompts, negative_prompts, image):
|
37 |
|