asehmi / streamlit-label-studio-frontend

A Streamlit component integrating Label Studio Frontend in Streamlit applications
MIT License
67 stars 12 forks source link

Load the bounding boxes from cache/json #5

Closed shyam573 closed 1 year ago

shyam573 commented 1 year ago

When an image is labelled, the annotations could be seen in the dataframe and in json below. When the app is reloaded, the labels are gone totally. Is there a way to keep the labels intact by loading from a custom json or keep in the cache? This is particularly useful when there are 100's of images.

asehmi commented 1 year ago

The results are held in session state and will only survive a Streamlit rerun, not a full browser window reload as the session state is renewed by Streamlit. You'll have to modify handle_event to persist results to a file or database. If you detect results for a task are empty, e.g., in the state initializer, instead of using empty_results_data to initialize, you can initialize using the state that was previously saved. You can also add an action to clear the persisted state manually, once the work is done. Ideally, you should have persisted state per task type.