PSNbst commited on
Commit
0d68b46
·
verified ·
1 Parent(s): 15831be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -18
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
- file_types=["image"], label="Upload Images", interactive=True, elem_id="upload-box"
88
- )
89
- with gr.Column(scale=2):
90
- preview_gallery = gr.Gallery(label="Preview Combined Images", columns=4)
91
-
92
- convert_button = gr.Button("Convert and Combine", elem_id="convert-button")
93
- download_zip = gr.Button("Download ZIP", elem_id="download-zip", visible=False)
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, output_zip],
102
  )
103
- download_zip.click(lambda zip_file: zip_file, inputs=[output_zip], outputs=output_zip)
 
 
 
 
 
 
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()