Closed Anti-Apple4life closed 2 years ago
I am not sure exactly what is happening, but I suspect that it is cause by the line 'st.session_state.update(st.session_state)'. If you are trying to update a session state in Streamlit, it is best to do it as such: st.session_state['key'] = 'new value'.
@mkhorasani i get the same error when using the following
def clear_session():
st.session_state['doctxt'] = ''
st.session_state['DOCfiles'] = []
raise
_StreamlitAPIException(SESSION_STATE_WRITES_NOT_ALLOWED_ERROR_TEXT) streamlit.errors.StreamlitAPIException: Values for st.button, st.download_button, st.file_uploader, st.data_editor, st.chat_input, and st.form cannot be set using st.sessionstate.
I'm new to streamlit, and I thought this would be an easy thing to do, as it is in most languages. I just need to clear everything out after a user is done processing so they can start a new entry. Is there a way to call a function in streamlit to reset or clear all the streamlit controls?
When I run my code, Streamlit throws an API exception. Here is the code that is concerns this problem: