| import gradio as gr |
| import os |
|
|
| |
| def process_images(layout, image_files): |
| |
| img_paths = [] |
| for img_file in image_files: |
| img_path = f"temp_images/{img_file.name}" |
| img_file.save(img_path) |
| img_paths.append(img_path) |
| |
| |
| return layout, img_paths |
|
|
| |
| iface = gr.Interface( |
| fn=process_images, |
| inputs=[ |
| gr.CheckboxGroup( |
| label="Choose Grid Layout", |
| choices=["1x2", "1x3", "2x2", "2x3"], |
| type="value" |
| ), |
| gr.File(label="Upload Images", type="file", multiple=True) |
| ], |
| outputs=["text", "json"], |
| live=True |
| ) |
|
|
| |
| iface.launch(share=True) |
|
|