Update the annotator

#3
by kcoda361 - opened

I am looking to update the annotator with a new image after pressing a button and running a function.

So far I am having my function return image_annotator(example2, image_type="numpy")

and I define my trigger like this

next_button.click(next_image, inputs = [annotator], outputs = [annotator])

Is there anyway to get gradio to update the annotator with a function? I am running this and it just sticks with the original annotation.

Owner

Hi @kcoda361 , thanks for the feedback!
There was an error with the update of the image value.

I've released a new version of the component with some changes, could you try it out?
pip install gradio-image-annotation==0.0.5

Hey, thanks for the quick response. I am still not getting the image to update. The new bounding box updates after a click on the image, but the original image stays

Owner

Could you tell me what Gradio version you are using and a code example so I can try to reproduce it?

Hey I am able to update it now. Not sure what happened to make it work, but it works now.

I am having another issue where the size of the displayed image depends on my screen size. Even if i specify width and height. This then effects where the bounding boxes are displayed.

I am setting 1920x1080 but the images are display as 1187x667. My bounding box calculations are for the image size of 1920x1080

How can I get the size of the image that is displayed so the bounding boxes line up?

Owner

Hi, I'm glad it's working now :)

Regarding the new issue, the images are automatically resized to fit the Gradio interface, but the boxes are automatically scaled to the correct size, so it must be transparent for the user.
However, there was an error with parsing the box coordinates when they were added after creating the component.
Could you try this new version?

pip install gradio-image-annotation==0.0.6

Thank you! That worked. Seems to be doing everything I want now. You have been a huge help, thank you for your time!

kcoda361 changed discussion status to closed

Sign up or log in to comment