import gradio as gr | |
from PIL import Image | |
# Define a function that takes an image as input and returns it | |
def display_image(image): | |
return image # Simply return the uploaded image | |
# Create the Gradio interface | |
iface = gr.Interface( | |
fn=display_image, # The function that handles the image | |
inputs="image", # Expect an image input from the user | |
outputs="image", # The output will also be an image | |
title="Image Upload and Display App", | |
description="Upload an image and it will be displayed below.", | |
) | |
# Launch the Gradio app | |
iface.launch() | |