Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from PIL import Image
|
| 3 |
-
import os
|
| 4 |
|
| 5 |
st.title("Happy Valentine's Day, My Love!")
|
| 6 |
|
|
@@ -11,19 +10,17 @@ correct_password = "anna" # Replace with your secret word
|
|
| 11 |
if password_entered == correct_password:
|
| 12 |
st.write("## Our Memories")
|
| 13 |
|
| 14 |
-
|
| 15 |
-
image_files = [f for f in os.listdir(image_folder) if os.path.isfile(os.path.join(image_folder, f))]
|
| 16 |
|
| 17 |
-
if
|
| 18 |
-
|
| 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(
|
| 24 |
-
st.image(image, caption=
|
| 25 |
except Exception as e:
|
| 26 |
-
st.error(f"Error opening image {
|
|
|
|
|
|
|
| 27 |
|
| 28 |
st.write("## Sweet Messages")
|
| 29 |
st.write("You're the most amazing person I know...") # Add your heartfelt messages here!
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from PIL import Image
|
|
|
|
| 3 |
|
| 4 |
st.title("Happy Valentine's Day, My Love!")
|
| 5 |
|
|
|
|
| 10 |
if password_entered == correct_password:
|
| 11 |
st.write("## Our Memories")
|
| 12 |
|
| 13 |
+
uploaded_files = st.file_uploader("Choose images", accept_multiple_files=True, type=["jpg", "png", "jpeg", "gif"]) # Allow GIF images
|
|
|
|
| 14 |
|
| 15 |
+
if uploaded_files:
|
| 16 |
+
for uploaded_file in uploaded_files:
|
|
|
|
|
|
|
|
|
|
| 17 |
try:
|
| 18 |
+
image = Image.open(uploaded_file)
|
| 19 |
+
st.image(image, caption=uploaded_file.name, use_column_width=True)
|
| 20 |
except Exception as e:
|
| 21 |
+
st.error(f"Error opening image {uploaded_file.name}: {e}")
|
| 22 |
+
else:
|
| 23 |
+
st.info("No images uploaded. Please upload some images.")
|
| 24 |
|
| 25 |
st.write("## Sweet Messages")
|
| 26 |
st.write("You're the most amazing person I know...") # Add your heartfelt messages here!
|