Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -77,30 +77,32 @@ def process_images(uploaded_images):
|
|
77 |
|
78 |
# Gradio UI
|
79 |
def main_interface():
|
80 |
-
with gr.Blocks() as interface:
|
81 |
with gr.Row():
|
82 |
gr.Markdown("### Image Resizer and Combiner")
|
83 |
-
|
84 |
with gr.Row():
|
85 |
-
with gr.Column(scale=1):
|
86 |
-
uploaded_files = gr.Files(
|
87 |
-
|
88 |
-
|
89 |
-
with gr.Column(scale=2):
|
90 |
-
preview_gallery = gr.Gallery(label="Preview Combined Images", columns=
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
output_zip = gr.File(label="Download Combined ZIP", visible=False)
|
96 |
-
|
97 |
-
# Bind functions
|
98 |
-
convert_button.click(
|
99 |
process_images,
|
100 |
inputs=[uploaded_files],
|
101 |
-
outputs=[preview_gallery,
|
102 |
)
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
return interface
|
105 |
|
106 |
main_interface().launch()
|
|
|
77 |
|
78 |
# Gradio UI
|
79 |
def main_interface():
|
80 |
+
with gr.Blocks(css=".gradio-container { height: 100vh; }") as interface:
|
81 |
with gr.Row():
|
82 |
gr.Markdown("### Image Resizer and Combiner")
|
83 |
+
|
84 |
with gr.Row():
|
85 |
+
with gr.Column(scale=1, elem_id="left-panel"):
|
86 |
+
uploaded_files = gr.Files(file_types=["image"], label="Upload Images", interactive=True)
|
87 |
+
combine_button = gr.Button("Combine and Process", elem_id="combine-button", color="orange")
|
88 |
+
|
89 |
+
with gr.Column(scale=2, elem_id="right-panel"):
|
90 |
+
preview_gallery = gr.Gallery(label="Preview Combined Images", columns=3, elem_id="preview-gallery")
|
91 |
+
download_zip_button = gr.Button("Download ZIP", elem_id="download-zip")
|
92 |
+
|
93 |
+
# Button actions
|
94 |
+
combine_button.click(
|
|
|
|
|
|
|
|
|
95 |
process_images,
|
96 |
inputs=[uploaded_files],
|
97 |
+
outputs=[preview_gallery, download_zip_button],
|
98 |
)
|
99 |
+
|
100 |
+
download_zip_button.click(
|
101 |
+
lambda x: x,
|
102 |
+
inputs=[],
|
103 |
+
outputs=[download_zip_button],
|
104 |
+
)
|
105 |
+
|
106 |
return interface
|
107 |
|
108 |
main_interface().launch()
|