I am trying to upload a file. The upload button works fine, able to upload file but after upload the page refreshes and view is same page without login. Could someone please share ideas/approaches for multi page app where logged in is visible only after successful login. (Only Login and Signup are options in sidebar at every page.)
Code:
placeholder = st.empty()
buff, col, buff2 = placeholder.beta_columns([3, 9, 3])
col.write("---------------------------------------------")
uploaded_file = col.file_uploader("Upload the source data file", type=['csv'])
time.sleep(10)
if uploaded_file.data:
...
... rest of the code for uploaded file's processing
I tested with time.sleep() and the page remains as long as sleep lasts but does not reach the check for uploaded_file is not None
Is this a wrong approach since I want to have uploader within width of col?
Hi @Manu.This is a problem which doesn’t have a oficial solution, called SessionState. There are some workarounds the community created, you can check this out here:
While i was develop my streamlit app, i had a similar problem as you, but was with st.number_input. Recently streamlit launch a new feature called st.forms which the aim is prevent the input that are located inside this form do not refresh, you can check following the link below:
Hi, thanks for you reply @feliperoque. And surely will check out Submit buttons and Forms and replace in the code.
I am already using SessionState to pass data along to multiple pages… The weird issue here seems to be the break in flow even after I upload file and process it on the same page. I hope this clears the question a bit more. As soon the file is uploaded the page sort of disappears even after having the process logic for it immediately after the file uploader.