Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -213,14 +213,9 @@ def run(
|
|
213 |
use_canny: bool = False,
|
214 |
progress=gr.Progress(track_tqdm=True),
|
215 |
) -> PIL.Image.Image:
|
216 |
-
width, height
|
217 |
-
|
218 |
-
|
219 |
-
max_size = 1024
|
220 |
-
ratio = min(max_size / width, max_size / height)
|
221 |
-
new_width = int(width * ratio)
|
222 |
-
new_height = int(height * ratio)
|
223 |
-
|
224 |
image = image['composite'].resize((new_width, new_height))
|
225 |
|
226 |
if use_canny:
|
@@ -261,7 +256,7 @@ def run(
|
|
261 |
height=new_height,
|
262 |
).images[0]
|
263 |
else:
|
264 |
-
|
265 |
prompt=prompt,
|
266 |
negative_prompt=negative_prompt,
|
267 |
image=image,
|
@@ -270,8 +265,7 @@ def run(
|
|
270 |
controlnet_conditioning_scale=controlnet_conditioning_scale,
|
271 |
guidance_scale=guidance_scale,
|
272 |
width=new_width,
|
273 |
-
height=new_height,
|
274 |
-
).images[0]
|
275 |
|
276 |
return (controlnet_img, out)
|
277 |
|
|
|
213 |
use_canny: bool = False,
|
214 |
progress=gr.Progress(track_tqdm=True),
|
215 |
) -> PIL.Image.Image:
|
216 |
+
width, height = image['composite'].size
|
217 |
+
ratio = np.sqrt(1024. * 1024. / (width * height))
|
218 |
+
new_width, new_height = int(width * ratio), int(height * ratio)
|
|
|
|
|
|
|
|
|
|
|
219 |
image = image['composite'].resize((new_width, new_height))
|
220 |
|
221 |
if use_canny:
|
|
|
256 |
height=new_height,
|
257 |
).images[0]
|
258 |
else:
|
259 |
+
out = pipe(
|
260 |
prompt=prompt,
|
261 |
negative_prompt=negative_prompt,
|
262 |
image=image,
|
|
|
265 |
controlnet_conditioning_scale=controlnet_conditioning_scale,
|
266 |
guidance_scale=guidance_scale,
|
267 |
width=new_width,
|
268 |
+
height=new_height,).images[0]
|
|
|
269 |
|
270 |
return (controlnet_img, out)
|
271 |
|