Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import numpy as np
|
| 3 |
-
from PIL import Image,
|
| 4 |
from collections import Counter
|
| 5 |
|
| 6 |
# Ensembles pour stocker les pixels validés et non validés
|
|
@@ -49,9 +49,7 @@ def generate_image_from_neighbors(base_pixels):
|
|
| 49 |
|
| 50 |
# Fonction pour appliquer un filtre à l'image
|
| 51 |
def apply_filter(image, filter_type):
|
| 52 |
-
if filter_type == "
|
| 53 |
-
return image.filter(ImageFilter.BLUR)
|
| 54 |
-
elif filter_type == "Contraste":
|
| 55 |
return ImageEnhance.Contrast(image).enhance(1.5)
|
| 56 |
return image
|
| 57 |
|
|
@@ -74,7 +72,7 @@ if uploaded_file:
|
|
| 74 |
st.image(Image.fromarray(base_pixels), caption="Image importée de référence", use_column_width=True)
|
| 75 |
|
| 76 |
# Options de filtres
|
| 77 |
-
filter_option = st.selectbox("Choisissez un filtre à appliquer :", ["Aucun", "
|
| 78 |
if filter_option != "Aucun":
|
| 79 |
base_image = Image.fromarray(base_pixels)
|
| 80 |
base_image = apply_filter(base_image, filter_option)
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import numpy as np
|
| 3 |
+
from PIL import Image, ImageEnhance
|
| 4 |
from collections import Counter
|
| 5 |
|
| 6 |
# Ensembles pour stocker les pixels validés et non validés
|
|
|
|
| 49 |
|
| 50 |
# Fonction pour appliquer un filtre à l'image
|
| 51 |
def apply_filter(image, filter_type):
|
| 52 |
+
if filter_type == "Contraste":
|
|
|
|
|
|
|
| 53 |
return ImageEnhance.Contrast(image).enhance(1.5)
|
| 54 |
return image
|
| 55 |
|
|
|
|
| 72 |
st.image(Image.fromarray(base_pixels), caption="Image importée de référence", use_column_width=True)
|
| 73 |
|
| 74 |
# Options de filtres
|
| 75 |
+
filter_option = st.selectbox("Choisissez un filtre à appliquer :", ["Aucun", "Contraste"])
|
| 76 |
if filter_option != "Aucun":
|
| 77 |
base_image = Image.fromarray(base_pixels)
|
| 78 |
base_image = apply_filter(base_image, filter_option)
|