import gradio as gr import os # Path to the folder containing images image_folder = "images" # Get the list of image files from the folder and prepare the image list image_list = [ (os.path.join(image_folder, filename), os.path.splitext(filename)[0]) for filename in os.listdir(image_folder) if filename.endswith(('.png', '.jpg', '.jpeg', 'webp')) # Add more extensions if needed ] with gr.Blocks() as demo: gr.Gallery(value=image_list, columns=3, show_label=True) # Show the label as the filename demo.launch()