Spaces:
Running
Running
File size: 2,302 Bytes
a2f9170 f6fe67a 0119943 ee37026 a2f9170 08e7895 6b5295a a2f9170 c59eeac f03604d a2f9170 68b7107 a2f9170 83d8d51 55f3903 eebc984 ee37026 eebc984 ee37026 55f3903 a2f9170 77e8e46 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
import streamlit as st
from PIL import Image
import os
# App title and description
st.set_page_config(page_title="Tarun-Shrishti wedding", page_icon="❤️", layout="centered")
st.title("🌟 #TASH")
st.write("Upload your images below (You can upload any number of times!)")
# Upload directory
UPLOAD_DIR = "uploaded_images"
os.makedirs(UPLOAD_DIR, exist_ok=True)
# Sidebar for navigation and instructions
with st.sidebar:
st.header("How to Use")
st.write("1. Click 'Browse files' to select images.")
st.write("2. Upload multiple images at once.")
st.write("3. View your uploaded images in the main area.")
st.write("Supported formats: JPG, PNG, GIF.")
# # Increase file upload size limit
# st.set_option("server.maxUploadSize", 1024)
# File uploader
uploaded_files = st.file_uploader(
"Choose image files", type=["jpg", "jpeg", "png", "gif"], accept_multiple_files=True
)
if uploaded_files:
st.success(f"You have uploaded {len(uploaded_files)} image(s).")
# Display uploaded images
st.subheader("Uploaded Images")
cols = st.columns(3)
for index, uploaded_file in enumerate(uploaded_files):
# Save uploaded file
file_path = os.path.join(UPLOAD_DIR, uploaded_file.name)
with open(file_path, "wb") as f:
f.write(uploaded_file.getbuffer())
# Display image
img = Image.open(file_path)
with cols[index % 3]:
st.image(img, caption=uploaded_file.name, width=200)
# Blank lines between image upload and text message
st.write("\n")
st.write("\n")
st.write("\n")
st.write("\n")
# Congratulation message input
st.subheader("Leave a Congratulation Message if you want ❤️ ")
message = st.text_area("Write your message here:", placeholder="Many Congratulations ....")
if st.button("Submit Message"):
if message:
st.success("Thank you for your message! ")
st.write(f"Your message: {message}")
else:
st.warning("Please write a message before submitting.")
# Footer
st.markdown("""
<style>
footer {visibility: hidden;}
footer:after {
content: 'Made with ❤️ using Streamlit';
visibility: visible;
display: block;
text-align: center;
padding: 5px;
font-size: 14px;
color: gray;
}
</style>
""", unsafe_allow_html=True)
|