Auto-weight-logger2 / src /streamlit_app.py
Sanjayraju30's picture
Update src/streamlit_app.py
5ba9ce7 verified
raw
history blame
647 Bytes
import streamlit as st
from PIL import Image
import io
st.set_page_config(page_title="πŸ“ Image Preview", layout="centered")
st.title("πŸ–ΌοΈ Image Uploader & Viewer")
# Upload image
uploaded_file = st.file_uploader("πŸ“ Upload a JPG, JPEG, or PNG image", type=["jpg", "jpeg", "png"])
# Show image
if uploaded_file is not None:
try:
image = Image.open(io.BytesIO(uploaded_file.read()))
st.image(image, caption="βœ… Uploaded Image", use_column_width=True)
except Exception as e:
st.error("❌ Could not open image.")
st.exception(e)
else:
st.info("πŸ“Œ Please upload an image to display it here.")