|
import streamlit as st
|
|
from PIL import Image, ImageEnhance
|
|
import requests
|
|
from io import BytesIO
|
|
|
|
st.title("Apple Image Playground")
|
|
|
|
|
|
url = "https://images.pexels.com/photos/1323550/pexels-photo-1323550.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
|
|
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")
|
|
|
|
|
|
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)
|
|
|