Spaces:
Running
on
Zero
Running
on
Zero
yonishafir
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -292,7 +292,11 @@ def generate_image(image_path, prompt, num_steps, guidance_scale, seed, num_imag
|
|
292 |
gc.collect()
|
293 |
torch.cuda.empty_cache()
|
294 |
|
295 |
-
return
|
|
|
|
|
|
|
|
|
296 |
|
297 |
### Description
|
298 |
title = r"""
|
@@ -362,7 +366,7 @@ with gr.Blocks(css=css) as demo:
|
|
362 |
minimum=1,
|
363 |
maximum=2,
|
364 |
step=1,
|
365 |
-
value=
|
366 |
)
|
367 |
ip_adapter_scale = gr.Slider(
|
368 |
label="ip adapter scale",
|
@@ -396,7 +400,8 @@ with gr.Blocks(css=css) as demo:
|
|
396 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
397 |
|
398 |
with gr.Column():
|
399 |
-
gallery = gr.Gallery(label="Generated Images")
|
|
|
400 |
|
401 |
submit.click(
|
402 |
fn=randomize_seed_fn,
|
@@ -407,7 +412,8 @@ with gr.Blocks(css=css) as demo:
|
|
407 |
).then(
|
408 |
fn=generate_image,
|
409 |
inputs=[img_file, prompt, num_steps, guidance_scale, seed, num_images, ip_adapter_scale, kps_scale, canny_scale],
|
410 |
-
outputs=[gallery]
|
|
|
411 |
)
|
412 |
|
413 |
gr.Markdown(Footer)
|
|
|
292 |
gc.collect()
|
293 |
torch.cuda.empty_cache()
|
294 |
|
295 |
+
return gr.Gallery.update(
|
296 |
+
value=images,
|
297 |
+
columns=1 if num_images == 1 else 2, # Show one column if one image, otherwise two
|
298 |
+
)
|
299 |
+
# return images
|
300 |
|
301 |
### Description
|
302 |
title = r"""
|
|
|
366 |
minimum=1,
|
367 |
maximum=2,
|
368 |
step=1,
|
369 |
+
value=2,
|
370 |
)
|
371 |
ip_adapter_scale = gr.Slider(
|
372 |
label="ip adapter scale",
|
|
|
400 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
401 |
|
402 |
with gr.Column():
|
403 |
+
# gallery = gr.Gallery(label="Generated Images")
|
404 |
+
gallery = gr.Gallery(label="Generated Images").style(grid=[2], height="auto") # Default to 2 columns
|
405 |
|
406 |
submit.click(
|
407 |
fn=randomize_seed_fn,
|
|
|
412 |
).then(
|
413 |
fn=generate_image,
|
414 |
inputs=[img_file, prompt, num_steps, guidance_scale, seed, num_images, ip_adapter_scale, kps_scale, canny_scale],
|
415 |
+
# outputs=[gallery]
|
416 |
+
outputs=gallery
|
417 |
)
|
418 |
|
419 |
gr.Markdown(Footer)
|