Update app.py
Browse files
app.py
CHANGED
@@ -24,7 +24,12 @@ def process_images(images, remove_bg):
|
|
24 |
|
25 |
# Update position for next image (for simplicity stacking vertically)
|
26 |
y_offset += img.height
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
28 |
return final_collage
|
29 |
|
30 |
# Gradio interface
|
@@ -32,7 +37,7 @@ with gr.Blocks() as demo:
|
|
32 |
gr.Markdown("## Sticker Collage Creator (A4)")
|
33 |
|
34 |
with gr.Row():
|
35 |
-
images = gr.
|
36 |
remove_bg = gr.Checkbox(label="Remove background?", value=True)
|
37 |
|
38 |
output = gr.Image(label="Collage", type="pil")
|
|
|
24 |
|
25 |
# Update position for next image (for simplicity stacking vertically)
|
26 |
y_offset += img.height
|
27 |
+
if y_offset + img.height > final_collage.height:
|
28 |
+
y_offset = 0
|
29 |
+
x_offset += img.width
|
30 |
+
if x_offset + img.width > final_collage.width:
|
31 |
+
break # Stop adding images if there's no more space
|
32 |
+
|
33 |
return final_collage
|
34 |
|
35 |
# Gradio interface
|
|
|
37 |
gr.Markdown("## Sticker Collage Creator (A4)")
|
38 |
|
39 |
with gr.Row():
|
40 |
+
images = gr.Files(label="Upload your images", file_types=["image"]) # Use gr.Files for multiple image uploads
|
41 |
remove_bg = gr.Checkbox(label="Remove background?", value=True)
|
42 |
|
43 |
output = gr.Image(label="Collage", type="pil")
|