merve HF staff commited on
Commit
d4d5b30
1 Parent(s): 9aa593c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
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
- ## TODO: Implement canny filter here
30
- return canny_image
 
 
 
 
 
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