I have created a streamlit app with multiple pages where I used Sessionstate. The problem is, buttons are displayed multiple times at random places. Actually they doesn’t look like original buttons. The buttons are also printed in pages where they are not used.
Undesirable behavior:
Found RerunException causing the error
session.request_rerun() also exhibit same problem.
Welcome to the Streamlit Community! If I understand your question correctly, on the main part of the web app (not in the side bar) your getting print outs of the valid and not valid over and over again and you want to get rid of these?
I think a minimal working example of your code would be very helpful for bug hunting the culprit of all the unwanted statements !
Based on your screenshot my initial guess was that your script was simply taking too long to run, in which case the faded buttons are working as intended. But I don’t see the “running man” animation on the top right, so that theory can’t be right. Something bigger must be afoot! Or did you hide that animation somehow?
Found RerunException causing the error
session.request_rerun() also exhibit same problem.
Are you saying this_session.request_rerun() is the source of the problem? What makes you think so?
Found there is a problem in caching spacy model.
Does this mean you found the issue? If so, what was it? I’d love to understand it!
Otherwise, if you’re still experiencing this issue, can you provide an even smaller example where the bug can be seen?
There’s so much going on in the code above, it’s hard to even get it running
For starters, I don’t know where you got the session_state code. So I tried removing everything that seemed unrelated to the bug itself and ended up with this:
import streamlit as st
for i in range(10):
st.write(f"This is iteration {i}")
valid = st.button("VALID", key=f'VALID_{i}')
not_valid = st.button("NOT VALID", key=f'NOTVALID_{i}')
if valid or not_valid:
st.write("Updated")
if st.button("NEXT"):
st.experimental_rerun()
But when I run this code but I don’t see the buggy behavior
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.