File size: 558 Bytes
8f8ddfc
 
 
 
 
 
 
 
4917c61
8f8ddfc
 
 
 
 
4917c61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import streamlit as st
from PIL import Image
import numpy as np

st.title("Image Average Pixel Calculator")
uploaded_file = st.file_uploader("Upload an image", type=["png", "jpg", "jpeg"])
if uploaded_file:
    image = Image.open(uploaded_file)
    st.image(image, caption="Your Image", use_container_width=True)
    image_np = np.array(image)
    if image_np.ndim == 3:
        avg_pixel = image_np.mean(axis=(0, 1))
    else:
        avg_pixel = image_np.mean()
    st.markdown("check out this [link](https://pubchem.ncbi.nlm.nih.gov/#query=%s)" % "CC=CC")