Spaces:
Sleeping
Sleeping
Update App. Py
Browse files
App. Py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from PIL import Image, ImageOps
|
| 3 |
|
| 4 |
-
#
|
| 5 |
def apply_effect(image, effect):
|
| 6 |
if effect == "kiss":
|
| 7 |
image = image.convert("L") # Convert to grayscale
|
|
@@ -12,17 +12,18 @@ def apply_effect(image, effect):
|
|
| 12 |
image = ImageOps.invert(image.convert("RGB"))
|
| 13 |
return image
|
| 14 |
|
| 15 |
-
# Streamlit app
|
| 16 |
st.title("Image Effect Converter")
|
| 17 |
|
| 18 |
# Upload image
|
| 19 |
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "png", "jpeg"])
|
| 20 |
|
| 21 |
if uploaded_file is not None:
|
|
|
|
| 22 |
image = Image.open(uploaded_file)
|
| 23 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 24 |
|
| 25 |
-
#
|
| 26 |
effect = st.selectbox("Choose an effect", ["kiss", "sepia", "invert"])
|
| 27 |
|
| 28 |
# Apply effect
|
|
@@ -30,7 +31,7 @@ if uploaded_file is not None:
|
|
| 30 |
processed_image = apply_effect(image, effect)
|
| 31 |
st.image(processed_image, caption="Processed Image", use_column_width=True)
|
| 32 |
|
| 33 |
-
# Download
|
| 34 |
processed_image.save("processed_image.png")
|
| 35 |
with open("processed_image.png", "rb") as file:
|
| 36 |
st.download_button(
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from PIL import Image, ImageOps
|
| 3 |
|
| 4 |
+
# Function to apply effects
|
| 5 |
def apply_effect(image, effect):
|
| 6 |
if effect == "kiss":
|
| 7 |
image = image.convert("L") # Convert to grayscale
|
|
|
|
| 12 |
image = ImageOps.invert(image.convert("RGB"))
|
| 13 |
return image
|
| 14 |
|
| 15 |
+
# Streamlit app
|
| 16 |
st.title("Image Effect Converter")
|
| 17 |
|
| 18 |
# Upload image
|
| 19 |
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "png", "jpeg"])
|
| 20 |
|
| 21 |
if uploaded_file is not None:
|
| 22 |
+
# Display the uploaded image
|
| 23 |
image = Image.open(uploaded_file)
|
| 24 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 25 |
|
| 26 |
+
# Select an effect
|
| 27 |
effect = st.selectbox("Choose an effect", ["kiss", "sepia", "invert"])
|
| 28 |
|
| 29 |
# Apply effect
|
|
|
|
| 31 |
processed_image = apply_effect(image, effect)
|
| 32 |
st.image(processed_image, caption="Processed Image", use_column_width=True)
|
| 33 |
|
| 34 |
+
# Download button
|
| 35 |
processed_image.save("processed_image.png")
|
| 36 |
with open("processed_image.png", "rb") as file:
|
| 37 |
st.download_button(
|