this may have been asked in different threads previously, e.g., there is a related thread, however it’s more than a year old and my question is slightly different:
Now that there is some rudimentary session management in streamlit, I was wondering if there was a simple way to encode/hash the entire app state into the URL – so that a URL exists that users can share e.g. to discuss a certain view on some visualised data. So I don’t just want the URL to contain which subpage is viewed but also the state of all checkboxes, sliders, et cetera. Any ideas how this could be archieved?
I’m not sure how it was done, but @AustinC has created an app that does something similar. It super cool, and allows the user to type up some Streamlit code in an editor and the output is displayed next to it. Then, you can hit a button “share your work” and a url is generated that saves the current state to send to people! Here is the link
@AustinC maybe you can post your github link to the code you used?
I use something similar for a ML lifecycle management application I built for my client using streamlit to share experiments. The better thing to do would be to save this session state json in a mongodb or some where else and just set the uid as a URL param and pick up the state on run of main from DB.
Because the URL params cant hold more than 2048 chars
Hope it helps !
PS. I think Austin is doing something similar, perhaps just dumping the JSONs on fs instead of a document store and all.
And if you’re already using the other session_state hack from here you could also do it like I show here where I also show a way of setting state of other widgets by the click of a button