Mavhas commited on
Commit
885127e
·
verified ·
1 Parent(s): d7c3247

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -21,11 +21,11 @@ if 'password_entered' not in st.session_state:
21
 
22
  if not st.session_state.password_entered:
23
  password_entered = st.text_input("Enter the secret word:", type="password")
24
- correct_password = "anna" # Replace with your secret word
25
 
26
  if password_entered == correct_password:
27
  st.session_state.password_entered = True
28
- st.rerun() # Use st.rerun()
29
 
30
  if st.session_state.password_entered:
31
  st.title("Happy Valentine's Day, My Love! ❤️")
@@ -169,7 +169,7 @@ if st.session_state.password_entered:
169
  del saved_data["messages"][i]
170
  with open("data.txt", "w") as f:
171
  f.write(str(saved_data))
172
- st.rerun() # Corrected
173
 
174
  new_message = st.text_area("Add a new message:", height=100)
175
  if st.button("Save Message"):
@@ -178,7 +178,7 @@ if st.session_state.password_entered:
178
  with open("data.txt", "w") as f:
179
  f.write(str(saved_data))
180
  st.success("Message saved!")
181
- st.rerun() # Corrected
182
 
183
  elif selected_tab == "Reasons":
184
  st.write("## Reasons I Love You")
@@ -193,11 +193,13 @@ if st.session_state.password_entered:
193
  del saved_data["reasons"][i]
194
  with open("data.txt", "w") as f:
195
  f.write(str(saved_data))
196
- st.rerun() # Corrected
197
 
198
  new_reason = st.text_input("Add a reason:")
199
  if st.button("Save Reason"):
200
  if new_reason:
201
  saved_data["reasons"].append(new_reason)
202
  with open("data.txt", "w") as f:
203
- f.write(
 
 
 
21
 
22
  if not st.session_state.password_entered:
23
  password_entered = st.text_input("Enter the secret word:", type="password")
24
+ correct_password = "yoursecretword" # Replace with your secret word
25
 
26
  if password_entered == correct_password:
27
  st.session_state.password_entered = True
28
+ st.rerun()
29
 
30
  if st.session_state.password_entered:
31
  st.title("Happy Valentine's Day, My Love! ❤️")
 
169
  del saved_data["messages"][i]
170
  with open("data.txt", "w") as f:
171
  f.write(str(saved_data))
172
+ st.rerun()
173
 
174
  new_message = st.text_area("Add a new message:", height=100)
175
  if st.button("Save Message"):
 
178
  with open("data.txt", "w") as f:
179
  f.write(str(saved_data))
180
  st.success("Message saved!")
181
+ st.rerun()
182
 
183
  elif selected_tab == "Reasons":
184
  st.write("## Reasons I Love You")
 
193
  del saved_data["reasons"][i]
194
  with open("data.txt", "w") as f:
195
  f.write(str(saved_data))
196
+ st.rerun()
197
 
198
  new_reason = st.text_input("Add a reason:")
199
  if st.button("Save Reason"):
200
  if new_reason:
201
  saved_data["reasons"].append(new_reason)
202
  with open("data.txt", "w") as f:
203
+ f.write(str(saved_data))
204
+ st.success("Reason saved!")
205
+ st.rer