import streamlit as st import cv2 import numpy as np from PIL import Image st.title("🖼️ Image to Grayscale Converter") uploaded_file = st.file_uploader("Upload an Image", type=["jpg", "jpeg", "png"]) if uploaded_file is not None: img = Image.open(uploaded_file) img_array = np.array(img) gray_image = cv2.cvtColor(img_array, cv2.COLOR_RGB2GRAY) st.subheader("Original Image") st.image(img, caption="Uploaded Image", use_column_width=True) st.subheader("Grayscale Image") st.image(gray_image, caption="Grayscale Image", use_column_width=True, channels="GRAY")