File size: 647 Bytes
fb1a823 c41b38b 17e765d fb1a823 5ba9ce7 d54c470 5ba9ce7 ae762c2 5ba9ce7 17e765d 5ba9ce7 51be189 5ba9ce7 51be189 5ba9ce7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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.")
|