Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -92,21 +92,25 @@ def get_canny_filter(image):
|
|
92 |
canny_image = Image.fromarray(image)
|
93 |
return canny_image
|
94 |
|
95 |
-
@spaces.GPU
|
96 |
def process(input_image, prompt, negative_prompt, num_steps, controlnet_conditioning_scale, seed):
|
97 |
-
generator = torch.manual_seed(seed)
|
98 |
|
99 |
# resize input_image to 1024x1024
|
100 |
input_image = resize_image(input_image)
|
101 |
|
102 |
canny_image = get_canny_filter(input_image)
|
103 |
|
104 |
-
images =
|
105 |
-
prompt, negative_prompt=negative_prompt, image=canny_image, num_inference_steps=num_steps, controlnet_conditioning_scale=float(controlnet_conditioning_scale),
|
106 |
-
generator=generator,
|
107 |
-
).images
|
108 |
|
109 |
return [canny_image,images[0]]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
block = gr.Blocks().queue()
|
112 |
|
|
|
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
|
98 |
input_image = resize_image(input_image)
|
99 |
|
100 |
canny_image = get_canny_filter(input_image)
|
101 |
|
102 |
+
images = generate_(prompt, negative_prompt, canny_image, num_steps, controlnet_conditioning_scale, seed)
|
|
|
|
|
|
|
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 |
+
generator = torch.manual_seed(seed)
|
109 |
+
images = pipe(
|
110 |
+
prompt, negative_prompt=negative_prompt, image=canny_image, num_inference_steps=num_steps, controlnet_conditioning_scale=float(controlnet_conditioning_scale),
|
111 |
+
generator=generator,
|
112 |
+
).images
|
113 |
+
return images
|
114 |
|
115 |
block = gr.Blocks().queue()
|
116 |
|