Issue with st.empty()

Hello all,

I am facing a special issue as shown in the recording. The following is what I require in steps.

  1. Select an option from the selectbar
  2. Login with the credentials
  3. On successful login, the login and password text_inputs should be vanished and file_uploader should arise.
  4. After this a text_input for number of layers should be present.

The problem is as follows.
The moment I enter the input and press enter, the text_input vanishes and previously hidden login text_inputs are again shown.

Please let me know if you have any solution for this. Thanks in advance.


Hey @Harish_Kodarapu,

We actually cant see your screen recording, as you can’t post screen recordings on the forum. I imagine your having an issue with the statefulness of your app based on your description. Because the text_input fields do not preserve the users selection after multiple clicks/interactions on the page, when you hit enter on the second text_input it resets the app and it runs the script from top to bottom again.

We are currently creating a session state for streamlit to combat this very thing. IN the mean time there are some workarounds:

Also, checkout our state survey if you want to be involved in the development of session state!

Happy Streamlit-ing!