File size: 1,165 Bytes
535107d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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()