import streamlit as st def main(): st.set_page_config(page_title="Terms of Service Agreement", page_icon=":guardsman:", layout="wide") st.title("Terms of Service Agreement") agreed = st.checkbox("I agree to the terms of service") username = st.text_input("Enter your username") if st.button("Submit") and agreed and username.strip(): st.experimental_rerun() st.session_state["user_name"] = username st.session_state["tos_agreed"] = True st.experimental_reroute("/congratulations") if not st.session_state.get("tos_agreed", False): return st.title("Congratulations!") st.write(f"Welcome to our platform, {st.session_state['user_name']}!") if __name__ == "__main__": main()