mokady commited on
Commit
d7b8b8a
1 Parent(s): 5fd09d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -44,10 +44,10 @@ def resize_image(image):
44
 
45
 
46
  @spaces.GPU
47
- def generate_(prompt, negative_prompt, canny_image, num_steps, controlnet_conditioning_scale, seed):
48
  generator = torch.Generator("cuda").manual_seed(seed)
49
  images = pipe(
50
- prompt, negative_prompt=negative_prompt, image=canny_image, num_inference_steps=num_steps, controlnet_conditioning_scale=float(controlnet_conditioning_scale),
51
  generator=generator,
52
  ).images
53
  return images
@@ -58,11 +58,11 @@ def process(input_image, prompt, negative_prompt, num_steps, controlnet_conditio
58
  # resize input_image to 1024x1024
59
  input_image = resize_image(input_image)
60
 
61
- canny_image = get_canny_filter(input_image)
62
 
63
- images = generate_(prompt, negative_prompt, canny_image, num_steps, controlnet_conditioning_scale, seed)
64
 
65
- return [canny_image,images[0]]
66
 
67
  block = gr.Blocks().queue()
68
 
 
44
 
45
 
46
  @spaces.GPU
47
+ def generate_(prompt, negative_prompt, grayscale_image, num_steps, controlnet_conditioning_scale, seed):
48
  generator = torch.Generator("cuda").manual_seed(seed)
49
  images = pipe(
50
+ prompt, negative_prompt=negative_prompt, image=grayscale_image, num_inference_steps=num_steps, controlnet_conditioning_scale=float(controlnet_conditioning_scale),
51
  generator=generator,
52
  ).images
53
  return images
 
58
  # resize input_image to 1024x1024
59
  input_image = resize_image(input_image)
60
 
61
+ grayscale_image = input_image.convert('L').convert('RGB')
62
 
63
+ images = generate_(prompt, negative_prompt, grayscale_image, num_steps, controlnet_conditioning_scale, seed)
64
 
65
+ return [grayscale_image,images[0]]
66
 
67
  block = gr.Blocks().queue()
68