coderai90's picture
Upload app.py
81cd9e0 verified
raw
history blame
941 Bytes
import streamlit as st
from PIL import Image, ImageEnhance
import requests
from io import BytesIO
st.title("Apple Image Playground")
# Using a placeholder image URL
url = "https://images.pexels.com/photos/1323550/pexels-photo-1323550.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" # Replace with your actual image URL when available
response = requests.get(url)
image = Image.open(BytesIO(response.content))
st.image(image, caption='Apple Image', use_container_width=True)
st.sidebar.title("Image Adjustments")
# Example adjustments
brightness = st.sidebar.slider('Brightness', 0.5, 3.0, 1.0)
contrast = st.sidebar.slider('Contrast', 0.5, 3.0, 1.0)
if st.button('Apply Adjustments'):
img_enhanced = ImageEnhance.Brightness(image).enhance(brightness)
img_enhanced = ImageEnhance.Contrast(img_enhanced).enhance(contrast)
st.image(img_enhanced, caption='Enhanced Image', use_container_width=True)