Zekun Wu commited on
Commit
f60efdc
1 Parent(s): e6cbfc2
Files changed (1) hide show
  1. pages/2_Benchmark_Data.py +10 -15
pages/2_Benchmark_Data.py CHANGED
@@ -10,28 +10,23 @@ Once verified, you can specify the number of samples you wish to retrieve and do
10
  """)
11
 
12
 
13
- def verify_password():
14
- """
15
- Prompts the user to enter a password and checks it against the environment variable.
16
- If the password is correct, sets the session state to indicate successful verification.
17
- """
18
-
19
- def on_password_entered():
20
- if password_input == os.getenv('DEMO_PASSWORD'):
21
- st.session_state['password_verified'] = True
22
  else:
23
- st.error("Incorrect password, please try again.")
24
 
25
  password_input = st.text_input("Enter Password:", type="password")
26
- submit_button = st.button("Submit", on_click=on_password_entered)
27
 
28
- if submit_button and not st.session_state.get('password_verified', False):
29
  st.error("Please enter a valid password to access the demo.")
30
 
31
 
32
- # Check if the password has been verified
33
- if not st.session_state.get('password_verified', False):
34
- verify_password()
35
  else:
36
  st.sidebar.success("Password Verified. Proceed with the demo.")
37
 
 
10
  """)
11
 
12
 
13
+ def check_password():
14
+ def password_entered():
15
+ if password_input == os.getenv('PASSWORD'):
16
+ st.session_state['password_correct'] = True
 
 
 
 
 
17
  else:
18
+ st.error("Incorrect Password, please try again.")
19
 
20
  password_input = st.text_input("Enter Password:", type="password")
21
+ submit_button = st.button("Submit", on_click=password_entered)
22
 
23
+ if submit_button and not st.session_state.get('password_correct', False):
24
  st.error("Please enter a valid password to access the demo.")
25
 
26
 
27
+
28
+ if not st.session_state.get('password_correct', False):
29
+ check_password()
30
  else:
31
  st.sidebar.success("Password Verified. Proceed with the demo.")
32