Download app.py from dsaigc/editor_1: direct link, hf CLI and curl.
- Browser
- Download file 691 Bytes
-
https://huggingface.co/spaces/dsaigc/editor_1/resolve/main/app.py
- Command line
-
hf download hf://spaces/dsaigc/editor_1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/dsaigc/editor_1/resolve/main/app.py
691 Bytes
| import os | |
| import gradio as gr | |
| from PIL import Image | |
| def load_images(source_file): | |
| images = [] | |
| for file in os.listdir(source_file): | |
| if file.endswith(".jpg"): | |
| image_path = os.path.join(source_file, file) | |
| image = Image.open(image_path) | |
| thumbnail = image.thumbnail((100, 100)) | |
| images.append(thumbnail) | |
| return images | |
| def show_thumbnails(source_file): | |
| images = load_images(source_file) | |
| return gr.outputs.ImageGroup(images) | |
| iface = gr.Interface(fn=show_thumbnails, inputs="text", outputs="image", title="Image Thumbnails", description="Load all .jpg images in a folder and display their thumbnails.") | |
| iface.launch() | |