CoolFace
Apppublic

dsaigc/editor_1

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
app.py24 linesDownload Raw Back to root
1 2import os3import gradio as gr4from PIL import Image5 6def load_images(source_file):7    images = []8    for file in os.listdir(source_file):9        if file.endswith(".jpg"):10            image_path = os.path.join(source_file, file)11            image = Image.open(image_path)12            thumbnail = image.thumbnail((100, 100))13            images.append(thumbnail)14    return images15 16def show_thumbnails(source_file):17    images = load_images(source_file)18    return gr.outputs.ImageGroup(images)19 20iface = gr.Interface(fn=show_thumbnails, inputs="text", outputs="image", title="Image Thumbnails", description="Load all .jpg images in a folder and display their thumbnails.")21iface.launch()22 23 24