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()