Deadmon commited on
Commit
213883e
·
verified ·
1 Parent(s): d1be92b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -23,6 +23,11 @@ control_modes = [
23
  "lq"
24
  ]
25
 
 
 
 
 
 
26
  @spaces.GPU
27
  def generate_image(prompt, control_image_depth, control_mode_depth_index, use_depth, control_image_canny, control_mode_canny_index):
28
  control_images = []
@@ -39,13 +44,14 @@ def generate_image(prompt, control_image_depth, control_mode_depth_index, use_de
39
  conditioning_scales.append(0.4)
40
 
41
  width, height = control_image_canny.shape[:2]
 
42
 
43
  image = pipe(
44
  prompt,
45
  control_image=control_images,
46
  control_mode=control_modes,
47
- width=width,
48
- height=height,
49
  controlnet_conditioning_scale=conditioning_scales,
50
  num_inference_steps=24,
51
  guidance_scale=3.5,
 
23
  "lq"
24
  ]
25
 
26
+ def adjust_dimensions(width, height):
27
+ adjusted_width = width - (width % 8)
28
+ adjusted_height = height - (height % 8)
29
+ return adjusted_width, adjusted_height
30
+
31
  @spaces.GPU
32
  def generate_image(prompt, control_image_depth, control_mode_depth_index, use_depth, control_image_canny, control_mode_canny_index):
33
  control_images = []
 
44
  conditioning_scales.append(0.4)
45
 
46
  width, height = control_image_canny.shape[:2]
47
+ adjusted_width, adjusted_height = adjust_dimensions(width, height)
48
 
49
  image = pipe(
50
  prompt,
51
  control_image=control_images,
52
  control_mode=control_modes,
53
+ width=adjusted_width,
54
+ height=adjusted_height,
55
  controlnet_conditioning_scale=conditioning_scales,
56
  num_inference_steps=24,
57
  guidance_scale=3.5,