Mavhas commited on
Commit
059f546
·
verified ·
1 Parent(s): 8fe6491

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +74 -17
app.py CHANGED
@@ -20,7 +20,7 @@ if not st.session_state.get('password_entered', False):
20
  )
21
 
22
  password_entered = st.text_input("", type="password", placeholder="Enter the secret word")
23
- correct_password = "anna" # Replace with your secret word
24
 
25
  if password_entered == correct_password:
26
  st.session_state.password_entered = True
@@ -164,22 +164,29 @@ if st.session_state.get('password_entered', False):
164
  f.write(str(saved_data))
165
  st.rerun()
166
 
167
- if st.button("Generate Random Compliment"):
168
  random_compliment = random.choice(compliments)
169
  st.write(f"💖 {random_compliment}")
170
-
171
- new_compliment = st.text_area("Add a new compliment:", height=70) # Corrected height
172
- if st.button("Save Compliment"):
173
- if new_compliment:
174
- saved_data["compliments"].append(new_compliment)
175
- with open("data.txt", "w") as f:
176
- f.write(str(saved_data))
177
- st.success("Compliment saved!")
178
- st.rerun()
179
 
180
  elif selected_tab == "Messages":
181
  st.write("## Sweet Messages")
182
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  if saved_data["messages"]:
184
  for i, message in enumerate(saved_data["messages"]):
185
  col1, col2 = st.columns([0.8, 0.2])
@@ -192,14 +199,64 @@ if st.session_state.get('password_entered', False):
192
  f.write(str(saved_data))
193
  st.rerun()
194
 
195
- new_message = st.text_area("Add a new message:", height=100)
196
- if st.button("Save Message"):
197
- if new_message:
198
- saved_data["messages"].append(new_message)
 
 
 
 
 
 
 
 
 
 
 
 
199
  with open("data.txt", "w") as f:
200
  f.write(str(saved_data))
201
- st.success("Message saved!")
202
  st.rerun()
203
 
204
  elif selected_tab == "Reasons":
205
- st.write("## Reasons I Love You")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  )
21
 
22
  password_entered = st.text_input("", type="password", placeholder="Enter the secret word")
23
+ correct_password = "yoursecretword" # Replace with your secret word
24
 
25
  if password_entered == correct_password:
26
  st.session_state.password_entered = True
 
164
  f.write(str(saved_data))
165
  st.rerun()
166
 
167
+ if st.button("Generate Compliment"):
168
  random_compliment = random.choice(compliments)
169
  st.write(f"💖 {random_compliment}")
170
+ saved_data["compliments"].append(random_compliment)
171
+ with open("data.txt", "w") as f:
172
+ f.write(str(saved_data))
173
+ st.rerun()
 
 
 
 
 
174
 
175
  elif selected_tab == "Messages":
176
  st.write("## Sweet Messages")
177
 
178
+ messages = [
179
+ "I love you more than words can say.",
180
+ "You're my everything.",
181
+ "You make me happier than I ever thought I could be.",
182
+ "I'm so lucky to have you in my life.",
183
+ "You're the most amazing woman I know.",
184
+ "I can't imagine my life without you.",
185
+ "You're my best friend, my lover, and my soulmate.",
186
+ "I cherish every moment I spend with you.",
187
+ "You're the most beautiful woman in the world.",
188
+ "I'm so grateful for your love and support."
189
+ ]
190
  if saved_data["messages"]:
191
  for i, message in enumerate(saved_data["messages"]):
192
  col1, col2 = st.columns([0.8, 0.2])
 
199
  f.write(str(saved_data))
200
  st.rerun()
201
 
202
+ if st.button("Generate Message"):
203
+ random_message = random.choice(messages)
204
+ st.markdown(f"<div style='
205
+
206
+
207
+ background-color: #ffe6f2; padding: 10px; border-radius: 5px; margin-bottom: 10px;'>{random_message}</div>", unsafe_allow_html=True)
208
+ saved_data["messages"].append(random_message)
209
+ with open("data.txt", "w") as f:
210
+ f.write(str(saved_data))
211
+ st.rerun()
212
+
213
+ # Custom message area
214
+ custom_message = st.text_area("Write a personal message for her:", height=100)
215
+ if st.button("Save Custom Message"):
216
+ if custom_message:
217
+ saved_data["messages"].append(custom_message)
218
  with open("data.txt", "w") as f:
219
  f.write(str(saved_data))
220
+ st.success("Custom message saved!")
221
  st.rerun()
222
 
223
  elif selected_tab == "Reasons":
224
+ st.write("## Reasons I Love You")
225
+
226
+ reasons = [
227
+ "Your smile brightens my day.",
228
+ "You're incredibly kind and compassionate.",
229
+ "You're intelligent and witty.",
230
+ "You have a great sense of humor.",
231
+ "You're beautiful inside and out.",
232
+ "You're supportive and encouraging.",
233
+ "You're passionate about what you do.",
234
+ "You're a great listener.",
235
+ "You make me laugh.",
236
+ "You're my best friend.",
237
+ "You inspire me to be a better person.",
238
+ "You make me feel loved and cherished.",
239
+ "You're my soulmate.",
240
+ "I love your adventurous spirit.",
241
+ "You make every day special."
242
+ ]
243
+
244
+ if saved_data["reasons"]:
245
+ for i, reason in enumerate(saved_data["reasons"]):
246
+ col1, col2 = st.columns([0.8, 0.2])
247
+ with col1:
248
+ st.write(f"{i+1}. {reason}")
249
+ with col2:
250
+ if st.button("Delete", key=f"delete_reason_{i}"):
251
+ del saved_data["reasons"][i]
252
+ with open("data.txt", "w") as f:
253
+ f.write(str(saved_data))
254
+ st.rerun()
255
+
256
+ if st.button("Generate Reason"):
257
+ random_reason = random.choice(reasons)
258
+ st.write(f"{random_reason}")
259
+ saved_data["reasons"].append(random_reason)
260
+ with open("data.txt", "w") as f:
261
+ f.write(str(saved_data))
262
+ st.rerun()