Spaces:
Build error
Build error
Download app.py from Inam65/steamlit-ui: direct link, hf CLI and curl.
- Browser
- Download file 698 Bytes
-
https://huggingface.co/spaces/Inam65/steamlit-ui/resolve/main/app.py
- Command line
-
hf download hf://spaces/Inam65/steamlit-ui/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Inam65/steamlit-ui/resolve/main/app.py
698 Bytes
| import streamlit as st | |
| import cv2 | |
| import numpy as np | |
| from PIL import Image | |
| # App title | |
| st.title("Image to Grayscale Converter 🎨➡️🖤") | |
| # File uploader | |
| uploaded_file = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"]) | |
| if uploaded_file is not None: | |
| # Read the uploaded image | |
| image = Image.open(uploaded_file) | |
| st.image(image, caption="Original Image", use_column_width=True) | |
| # Convert the image to an OpenCV format | |
| img_array = np.array(image) | |
| # Convert to grayscale | |
| gray_image = cv2.cvtColor(img_array, cv2.COLOR_RGB2GRAY) | |
| # Display the grayscale image | |
| st.image(gray_image, caption="Grayscale Image", use_column_width=True, clamp=True) | |