import gradio as gr | |
from gradio_image_prompter import ImagePrompter | |
# Define the Gradio interface | |
demo = gr.Interface( | |
fn=lambda prompts: ( | |
prompts["image"], | |
prompts["points"], | |
), # Extract image and points from the ImagePrompter | |
inputs=ImagePrompter( | |
show_label=False | |
), # ImagePrompter for image input and point selection | |
outputs=[ | |
gr.Image(show_label=False), | |
gr.Dataframe(label="Points"), | |
], # Outputs: Image and DataFrame of points | |
title="Image Point Collector", | |
description="Upload an image, click on it, and get the coordinates of the clicked points.", | |
) | |
# Launch the Gradio app | |
demo.launch() | |