gpt-3.5-turbo-0125· OpenAI
WildChat-4.8M (AI2)
in streamlit how to make reload a sub-page load from start page
- User
in streamlit how to make reload a sub-page load from start page
- Assistant
To make a sub-page in Streamlit reload from the start page, you can include a button or a checkbox on the sub-page that, when clicked, resets the app back to the start page. Here's an example code snippet to illustrate this:
pythonimport streamlit as st def main(): # Sidebar navigation page = st.sidebar.radio("Navigation", ["Page 1", "Page 2"]) if page == "Page 1": # Page 1 content st.write("This is Page 1") # Button to reload from start page if st.button("Reload from Start Page"): st.experimental_rerun() elif page == "Page 2": # Page 2 content st.write("This is Page 2") # Button to reload from start page if st.button("Reload from Start Page"): st.experimental_rerun() if __name__ == "__main__": main()