Akshayram1 commited on
Commit
8ad1af4
·
verified ·
1 Parent(s): 8b03900

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -33,7 +33,8 @@ def main():
33
  # If already logged in, redirect to the main app (app2.py)
34
  if st.session_state.logged_in:
35
  st.success("You are already logged in.")
36
- st.experimental_rerun() # Refresh to show app2.py
 
37
 
38
  # Login form if not logged in
39
  else:
@@ -49,9 +50,10 @@ def main():
49
 
50
  # Store session state and redirect to app2.py
51
  st.success("Successfully logged in!")
52
- st.experimental_rerun()
 
53
 
54
- # You can use os.system to switch to app2.py after login
55
  os.system('streamlit run app2.py')
56
  else:
57
  st.error("Login failed. Please check your credentials.")
 
33
  # If already logged in, redirect to the main app (app2.py)
34
  if st.session_state.logged_in:
35
  st.success("You are already logged in.")
36
+ st.write("Redirecting to your dashboard...")
37
+ st.experimental_set_query_params(page="app2") # Set URL query to indicate page switch
38
 
39
  # Login form if not logged in
40
  else:
 
50
 
51
  # Store session state and redirect to app2.py
52
  st.success("Successfully logged in!")
53
+ st.write("Redirecting to your dashboard...")
54
+ st.experimental_set_query_params(page="app2") # Set URL query to indicate page switch
55
 
56
+ # Alternatively, you can manually run app2.py if necessary
57
  os.system('streamlit run app2.py')
58
  else:
59
  st.error("Login failed. Please check your credentials.")