PhyscalX / gradio-image-prompter

Image Prompter for Gradio
Apache License 2.0
68 stars 11 forks source link

Loading Component as Example #5

Open niki-amini-naieni opened 3 months ago

niki-amini-naieni commented 3 months ago

Hello, thank you for your useful contribution! I am wondering how I could load an ImagePrompter using the gr.Examples component and display the annotated boxes as well. Right now, all that is loaded is the image. I assume this has to do with the fact that the ImagePrompter as_example function only uses the image and discards of the points.

PhyscalX commented 3 months ago

Hi, @niki-amini-naieni

Currently, ImagePrompter is not supported to accept points from Python and draw them in the JS frontend. You can use a hidden Dataframe component to accept the example points and draw them using cv2 or matplotlib.

niki-amini-naieni commented 3 months ago

@PhyscalX, thank you for your response. My issue is not drawing the points onto the image. My issue is that if I provide an example ImagePrompter input (as shown below)

image

The points are not sent to the function that takes the example as input. For some reason, loading example inputs into ImagePrompter does not load the points. It just loads the image.