|
|
import streamlit as st |
|
|
import os |
|
|
from PIL import Image |
|
|
import random |
|
|
|
|
|
st.set_page_config(page_title="Valentine's Day Surprise", page_icon="❤️", layout="wide") |
|
|
|
|
|
|
|
|
if not st.session_state.get('password_entered', False): |
|
|
col1, col2, col3 = st.columns([1, 2, 1]) |
|
|
with col2: |
|
|
try: |
|
|
image = Image.open("hvd.jpeg") |
|
|
st.image(image, use_container_width=True) |
|
|
except FileNotFoundError: |
|
|
st.error("Image file not found. Please place 'hvd.jpeg' in the same directory as your script.") |
|
|
|
|
|
st.markdown( |
|
|
""" |
|
|
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 50vh;"> <h1 style="color: #f08080; font-family: 'Arial', sans-serif; font-size: 2em; margin-bottom: 0.5em;">Happy Valentine's Day!</h1> <p style="font-size: 1.2em; margin-bottom: 1em;">Enter the secret word to unlock the surprise:</p> <input type="password" id="password" placeholder="Enter the secret word" style="padding: 10px; font-size: 1em; border: 2px solid #f08080; border-radius: 5px; width: 80%; max-width: 300px;"> </div> |
|
|
""", |
|
|
unsafe_allow_html=True, |
|
|
) |
|
|
|
|
|
password_entered = st.text_input("", type="password", key="password_input") |
|
|
correct_password = "anna" |
|
|
|
|
|
if password_entered == correct_password: |
|
|
st.session_state.password_entered = True |
|
|
st.rerun() |
|
|
|
|
|
elif password_entered: |
|
|
st.error("Incorrect secret word. Try again.") |
|
|
|
|
|
|
|
|
|
|
|
if st.session_state.get('password_entered', False): |
|
|
|
|
|
if os.path.exists("data.txt"): |
|
|
with open("data.txt", "r") as f: |
|
|
try: |
|
|
saved_data = eval(f.read()) |
|
|
except: |
|
|
saved_data = {"messages": [], "reasons": [], "compliments": []} |
|
|
else: |
|
|
saved_data = {"messages": [], "reasons": [], "compliments": []} |
|
|
|
|
|
st.title("Happy Valentine's Day, My Love! ❤️") |
|
|
|
|
|
|
|
|
st.markdown( |
|
|
""" |
|
|
<style> |
|
|
body { |
|
|
background-color: #f8f0e3; |
|
|
font-family: 'Arial', sans-serif; |
|
|
} |
|
|
.stButton>button { |
|
|
background-color: #f08080 !important; |
|
|
color: white !important; |
|
|
border: none; |
|
|
padding: 10px 20px; |
|
|
border-radius: 5px; |
|
|
} |
|
|
.stTextInput, .stTextArea, .stSelectbox { |
|
|
border: 2px solid #f08080; |
|
|
border-radius: 5px; |
|
|
} |
|
|
</style> |
|
|
""", |
|
|
unsafe_allow_html=True, |
|
|
) |
|
|
|
|
|
|
|
|
st.markdown( |
|
|
""" |
|
|
<div style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;"> |
|
|
<div class="heart"></div> |
|
|
<div class="heart" style="left: 10%; animation-delay: 2s;"></div> |
|
|
<div class="heart" style="left: 20%; animation-delay: 1s;"></div> |
|
|
<div class="heart" style="left: 30%; animation-delay: 3s;"></div> |
|
|
<div class="heart" style="left: 40%; animation-delay: 0.5s;"></div> |
|
|
<div class="heart" style="left: 50%; animation-delay: 2.5s;"></div> |
|
|
<div class="heart" style="left: 60%; animation-delay: 1.5s;"></div> |
|
|
<div class="heart" style="left: 70%; animation-delay: 3.5s;"></div> |
|
|
<div class="heart" style="left: 80%; animation-delay: 0.8s;"></div> |
|
|
<div class="heart" style="left: 90%; animation-delay: 2.2s;"></div> |
|
|
</div> |
|
|
|
|
|
<style> |
|
|
.heart { |
|
|
position: absolute; |
|
|
width: 30px; |
|
|
height: 30px; |
|
|
background-color: #f08080; |
|
|
transform: rotate(-45deg); |
|
|
animation: heartAnimation 5s linear infinite; |
|
|
} |
|
|
|
|
|
.heart::before, |
|
|
.heart::after { |
|
|
content: ""; |
|
|
position: absolute; |
|
|
width: 30px; |
|
|
height: 30px; |
|
|
border-radius: 50%; |
|
|
background-color: #f08080; |
|
|
} |
|
|
|
|
|
.heart::before { |
|
|
top: -15px; |
|
|
left: 0; |
|
|
} |
|
|
|
|
|
.heart::after { |
|
|
top: 0; |
|
|
left: 15px; |
|
|
} |
|
|
|
|
|
@keyframes heartAnimation { |
|
|
0% { |
|
|
top: -50px; |
|
|
opacity: 0; |
|
|
} |
|
|
50% { |
|
|
opacity: 1; |
|
|
} |
|
|
100% { |
|
|
top: 100vh; |
|
|
opacity: 0; |
|
|
} |
|
|
} |
|
|
</style> |
|
|
""", |
|
|
unsafe_allow_html=True, |
|
|
) |
|
|
|
|
|
|
|
|
tabs = ["Compliments", "Messages", "Reasons"] |
|
|
selected_tab = st.sidebar.radio("Select a tab:", tabs) |
|
|
|
|
|
if selected_tab == "Compliments": |
|
|
st.write("## Sweet Compliments") |
|
|
|
|
|
compliments = [ |
|
|
"You have the most beautiful smile.", |
|
|
"Your kindness is inspiring.", |
|
|
"You’re incredibly intelligent and witty.", |
|
|
"You make every day an adventure.", |
|
|
"Your laugh is contagious and makes me so happy.", |
|
|
"You have a heart of gold.", |
|
|
"You’re the most supportive person I know.", |
|
|
"You have amazing taste in everything.", |
|
|
"You’re my best friend and my soulmate.", |
|
|
"You’re simply amazing!" |
|
|
] |
|
|
|
|
|
if saved_data["compliments"]: |
|
|
for i, compliment in enumerate(saved_data["compliments"]): |
|
|
col1, col2 = st.columns([0.8, 0.2]) |
|
|
with col1: |
|
|
st.write(f"{i+1}. {compliment}") |
|
|
with col2: |
|
|
if st.button("Delete", key=f"delete_compliment_{i}"): |
|
|
del saved_data["compliments"][i] |
|
|
with open("data.txt", "w") as f: |
|
|
f.write(str(saved_data)) |
|
|
st.rerun() |
|
|
|
|
|
if st.button("Generate Compliment"): |
|
|
random_compliment = random.choice(compliments) |
|
|
st.write(f"💖 {random_compliment}") |
|
|
saved_data["compliments"].append(random_compliment) |
|
|
with open("data.txt", "w") as f: |
|
|
f.write(str(saved_data)) |
|
|
st.rerun() |
|
|
|
|
|
elif selected_tab == "Messages": |
|
|
st.write("## Sweet Messages") |
|
|
|
|
|
messages = [ |
|
|
"I love you more than words can say.", |
|
|
"You're my everything.", |
|
|
"You make me happier than I ever thought I could be.", |
|
|
"I'm so lucky to have you in my life.", |
|
|
"You're the most amazing woman I know.", |
|
|
"I can't imagine my life without you.", |
|
|
"You're my best friend, my lover, and my soulmate.", |
|
|
"I cherish every moment I spend with you.", |
|
|
"You're the most beautiful woman in the world.", |
|
|
"I'm so grateful for your love and support." |
|
|
] |
|
|
if saved_data["messages"]: |
|
|
for i, message in enumerate(saved_data["messages"]): |
|
|
col1, col2 = st.columns([0.8, 0.2]) |
|
|
with col1: |
|
|
st.markdown(f"<div style='background-color: #ffe6f2; padding: 10px; border-radius: 5px; margin-bottom: 10px;'>{message}</div>", unsafe_allow_html=True) |
|
|
with col2: |
|
|
if st.button("Delete", key=f"delete_message_{i}"): |
|
|
del saved_data["messages"][i] |
|
|
with open("data.txt", "w") as f: |
|
|
f.write(str(saved_data)) |
|
|
st.rerun() |
|
|
|
|
|
if st.button("Generate Message"): |
|
|
random_message = random.choice(messages) |
|
|
html_string = f"""<div style='background-color: #ffe6f2; padding: 10px; border-radius: 5px; margin-bottom: 10px;'>{random_message}</div>""" |
|
|
st.markdown(html_string, unsafe_allow_html=True) |
|
|
saved_data["messages"].append(random_message) |
|
|
with open("data.txt", "w") as f: |
|
|
f.write(str(saved_data)) |
|
|
st.rerun() |
|
|
|
|
|
|
|
|
custom_message = st.text_area("Write a personal message for her:", height=100) |
|
|
if st.button("Save Custom Message"): |
|
|
if custom_message: |
|
|
saved_data["messages"].append(custom_message) |
|
|
with open("data.txt", "w") as f: |
|
|
f.write(str(saved_data)) |
|
|
st.success("Custom message saved!") |
|
|
st.rerun() |
|
|
|
|
|
elif selected_tab == "Reasons": |
|
|
st.write("## Reasons I Love You") |
|
|
|
|
|
reasons = [ |
|
|
"Your smile brightens my day.", |
|
|
"You're incredibly kind and compassionate.", |
|
|
"You're intelligent and witty.", |
|
|
"You have a great sense of humor.", |
|
|
"You're beautiful inside and out.", |
|
|
"You're supportive and encouraging.", |
|
|
"You're passionate about what you do.", |
|
|
"You're a great listener.", |
|
|
"You make me laugh.", |
|
|
"You're my best friend.", |
|
|
"You inspire me to be a better person.", |
|
|
"You make me feel loved and cherished.", |
|
|
"You're my soulmate.", |
|
|
"I love your adventurous spirit.", |
|
|
"You make every day special." |
|
|
] |
|
|
if saved_data["reasons"]: |
|
|
for i, reason in enumerate(saved_data["reasons"]): |
|
|
col1, col2 = st.columns([0.8, 0.2]) |
|
|
with col1: |
|
|
st.write(f"{i+1}. {reason}") |
|
|
with col2: |
|
|
if st.button("Delete", key=f"delete_reason_{i}"): |
|
|
del saved_data["reasons"][i] |
|
|
with open("data.txt", "w") as f: |
|
|
f.write(str(saved_data)) |
|
|
st.rerun() |
|
|
|
|
|
if st.button("Generate Reason"): |
|
|
random_reason = random.choice(reasons) |
|
|
st.write(f"{random_reason}") |
|
|
saved_data["reasons"].append(random_reason) |
|
|
with open("data.txt", "w") as f: |
|
|
f.write(str(saved_data)) |
|
|
st.rerun() |