andfanilo / streamlit-drawable-canvas

Do you like Quick, Draw? Well what if you could train/predict doodles drawn inside Streamlit? Also draws lines, circles and boxes over background images for annotation.
https://drawable-canvas.streamlit.app/
MIT License
563 stars 85 forks source link

Feature request: tag annotations #41

Closed robmarkcole closed 3 years ago

robmarkcole commented 3 years ago

I am annotation regions of interest (ROI) and displaying them in a dataframe for a text extraction app. I would like to auto generate an incrementing tag for the regions, e.g. region_1, region_2 etc and have this displayed inside the annotation and also in the dataframe, so that people can associate the data. Is this currently possible, or a feature request? Cheers and great work!

image

andfanilo commented 3 years ago

This has been on my mind for a while, and I know it's possible.

But it's not yet something that I had prioritized. Maybe you can check out https://discuss.streamlit.io/t/new-component-streamlit-labelstudio-allows-you-to-embed-the-label-studio-annotation-frontend-into-your-application/9524, and tell me if it does the trick ? I have yet to test it :) if it doesn't fit your needs I'll check out on adding this.

robmarkcole commented 3 years ago

Thanks for the link, label studio does look awesome and obviously designed for annotation. I still think this is a valuable feature addition as I imagine it is a common use case to be able to reference annotations elsewhere in an app

robmarkcole commented 3 years ago

I am currently trying the approach below, where I want to associate the label_name with the stroke_colour. Any suggestions how I can cache this releationship, in order to show the correct label/colour combo in the dataframe?

image

robmarkcole commented 3 years ago

Alright I kinda hacked together using a persistent dict

image

Source https://github.com/robmarkcole/aws-text-extraction-app/blob/ISSUE1/app/app.py

andfanilo commented 3 years ago

https://share.streamlit.io/andfanilo/streamlit-drawable-canvas-demo/app.py in page "Color based image annotation"

Ahah I was just building you an example with SessionState but looks like you managed before me :rofl:

robmarkcole commented 3 years ago

Looks like you settled on a very similar approach! In your demo I get an error:

image

The ability to clear the state will be useful

andfanilo commented 3 years ago

Hmmmm this is odd, I reported this here and I thought it was fixed but it seems it isn't depending on users ? What system/browser are you on?

andfanilo commented 3 years ago

The ability to clear the state will be useful

Yeaaaah...I'll let this as an user exercise :) also Session State should be worked on soonish in Streamlit so I'll be waiting for this before further changes ;)

robmarkcole commented 3 years ago

What system/browser are you on? -> Chrome, Big Sur

Re sessions state, my workaround is to kill and rerun the app

andfanilo commented 3 years ago

Does it happen on https://share.streamlit.io/andfanilo/s4a-color-picker-bug/main/app.py? Will see if I reopen the issue then.

andfanilo commented 3 years ago

Also since we have 2 workarounds now on image annotation, I'll close this soon except if you have other things to add ;)

robmarkcole commented 3 years ago

Still an issue on that link you provided

image

I will close this feature request