mokady commited on
Commit
a9d82c4
1 Parent(s): 54845dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -92,6 +92,17 @@ def get_canny_filter(image):
92
  canny_image = Image.fromarray(image)
93
  return canny_image
94
 
 
 
 
 
 
 
 
 
 
 
 
95
  def process(input_image, prompt, negative_prompt, num_steps, controlnet_conditioning_scale, seed):
96
 
97
  # resize input_image to 1024x1024
@@ -103,15 +114,7 @@ def process(input_image, prompt, negative_prompt, num_steps, controlnet_conditio
103
 
104
  return [canny_image,images[0]]
105
 
106
- @spaces.GPU
107
- def generate_(prompt, negative_prompt, canny_image, num_steps, controlnet_conditioning_scale, seed):
108
- pipe.to('cuda')
109
- generator = torch.Generator("cuda").manual_seed(seed)
110
- images = pipe(
111
- prompt, negative_prompt=negative_prompt, image=canny_image, num_inference_steps=num_steps, controlnet_conditioning_scale=float(controlnet_conditioning_scale),
112
- generator=generator,
113
- ).images
114
- return images
115
 
116
  block = gr.Blocks().queue()
117
 
 
92
  canny_image = Image.fromarray(image)
93
  return canny_image
94
 
95
+ @spaces.GPU
96
+ def generate_(prompt, negative_prompt, canny_image, num_steps, controlnet_conditioning_scale, seed):
97
+ pipe.to('cuda')
98
+ generator = torch.Generator("cuda").manual_seed(seed)
99
+ images = pipe(
100
+ prompt, negative_prompt=negative_prompt, image=canny_image, num_inference_steps=num_steps, controlnet_conditioning_scale=float(controlnet_conditioning_scale),
101
+ generator=generator,
102
+ ).images
103
+ return images
104
+
105
+
106
  def process(input_image, prompt, negative_prompt, num_steps, controlnet_conditioning_scale, seed):
107
 
108
  # resize input_image to 1024x1024
 
114
 
115
  return [canny_image,images[0]]
116
 
117
+
 
 
 
 
 
 
 
 
118
 
119
  block = gr.Blocks().queue()
120