Mavhas commited on
Commit
222240f
·
verified ·
1 Parent(s): 386613a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -13
app.py CHANGED
@@ -4,31 +4,39 @@ import os
4
 
5
  st.title("Happy Valentine's Day, My Love!")
6
 
7
- # Placeholder for password (not real security)
8
  password_entered = st.text_input("Enter the secret word:", type="password")
9
-
10
- correct_password = "yoursecretword" # Replace with a word or phrase
11
 
12
  if password_entered == correct_password:
13
  st.write("## Our Memories")
14
 
15
- image_folder = "static" # Path to your image folder
16
  image_files = [f for f in os.listdir(image_folder) if os.path.isfile(os.path.join(image_folder, f))]
17
 
18
- for image_file in image_files:
19
- image_path = os.path.join(image_folder, image_file)
20
- image = Image.open(image_path)
21
- st.image(image, caption=image_file, use_column_width=True)
 
 
 
 
 
 
22
 
23
  st.write("## Sweet Messages")
24
- st.write("You're the most amazing person I know...") # Add your messages
 
 
25
 
26
  st.write("## Reasons I Love You")
27
- st.write("- Your smile")
28
- st.write("- Your kindness") # Add your reasons
 
29
 
30
- elif password_entered: # Show message if something was entered
31
  st.error("Incorrect secret word. Try again.")
32
 
33
- else: #Initial state
34
  st.info("Enter the secret word to unlock the surprises!")
 
4
 
5
  st.title("Happy Valentine's Day, My Love!")
6
 
7
+ # Password logic (for simulation only - NOT secure)
8
  password_entered = st.text_input("Enter the secret word:", type="password")
9
+ correct_password = "anna" # Replace with your secret word
 
10
 
11
  if password_entered == correct_password:
12
  st.write("## Our Memories")
13
 
14
+ image_folder = "static" # Relative path to your image folder
15
  image_files = [f for f in os.listdir(image_folder) if os.path.isfile(os.path.join(image_folder, f))]
16
 
17
+ if not image_files: # Check if there are any images
18
+ st.warning("No images found in the 'static' folder. Please add some!")
19
+ else:
20
+ for image_file in image_files:
21
+ image_path = os.path.join(image_folder, image_file)
22
+ try:
23
+ image = Image.open(image_path)
24
+ st.image(image, caption=image_file, use_column_width=True)
25
+ except Exception as e:
26
+ st.error(f"Error opening image {image_file}: {e}")
27
 
28
  st.write("## Sweet Messages")
29
+ st.write("You're the most amazing person I know...") # Add your heartfelt messages here!
30
+ st.write("I love your smile, your kindness, and everything about you.")
31
+ st.write("You make every day brighter.")
32
 
33
  st.write("## Reasons I Love You")
34
+ st.write("- Your infectious laughter")
35
+ st.write("- Your unwavering support")
36
+ st.write("- Your beautiful heart") # Add more reasons!
37
 
38
+ elif password_entered: # If something was entered but incorrect
39
  st.error("Incorrect secret word. Try again.")
40
 
41
+ else: # Initial state (no password entered yet)
42
  st.info("Enter the secret word to unlock the surprises!")