Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ from datasets import load_dataset
|
|
8 |
from sklearn.cluster import KMeans
|
9 |
import matplotlib.pyplot as plt
|
10 |
from huggingface_hub import hf_hub_download
|
|
|
11 |
|
12 |
# Download and load model and encoded images
|
13 |
model_path = hf_hub_download(repo_id="eybro/autoencoder", filename="autoencoder_model.keras", repo_type='model')
|
@@ -77,7 +78,9 @@ def process_image(image):
|
|
77 |
|
78 |
def inference(user_image=None, selected_example=None):
|
79 |
|
80 |
-
if user_image is not None:
|
|
|
|
|
81 |
input_image = process_image(user_image)
|
82 |
elif selected_example is not None:
|
83 |
print(selected_example)
|
|
|
8 |
from sklearn.cluster import KMeans
|
9 |
import matplotlib.pyplot as plt
|
10 |
from huggingface_hub import hf_hub_download
|
11 |
+
from PIL import Image
|
12 |
|
13 |
# Download and load model and encoded images
|
14 |
model_path = hf_hub_download(repo_id="eybro/autoencoder", filename="autoencoder_model.keras", repo_type='model')
|
|
|
78 |
|
79 |
def inference(user_image=None, selected_example=None):
|
80 |
|
81 |
+
if user_image is not None and selected_example is not None:
|
82 |
+
return "Please upload an image or select an example image."
|
83 |
+
elif user_image is not None:
|
84 |
input_image = process_image(user_image)
|
85 |
elif selected_example is not None:
|
86 |
print(selected_example)
|