Spaces:
Sleeping
Sleeping
import streamlit as st | |
from PIL import Image, ImageFilter | |
from preprocess import removeBg | |
import os | |
# def process_image(input_image): | |
# # Open the uploaded image | |
# img = Image.open(input_image) | |
# # Apply some image processing (for example, applying a Gaussian blur) | |
# processed_img = img.filter(ImageFilter.GaussianBlur(radius=5)) | |
# return processed_img | |
def main(): | |
st.title("Image Processing App") | |
uploaded_image = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"]) | |
if uploaded_image is not None: | |
st.image(uploaded_image, caption="Uploaded Image", use_column_width=True) | |
img = Image.open(uploaded_image) | |
img.save('uploaded_image.jpg') | |
if st.button("Process Image"): | |
# processed_image = process_image(uploaded_image) | |
removeBg('uploaded_image.jpg') | |
filtered_image = os.listdir('static/results')[0] | |
filtered_image_path = f"static/results/{filtered_image}" | |
# Display the processed image | |
st.image(filtered_image_path, caption="Filtered Image", use_column_width=True) | |
if __name__ == "__main__": | |
main() | |