Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,10 +13,11 @@ import numpy as np
|
|
13 |
model = load_model('cat_classifier_model.h5')
|
14 |
|
15 |
def predict_cat(image_pil):
|
16 |
-
|
17 |
-
img_array = np.expand_dims(img_array, axis=0)
|
18 |
-
img_array = img_array / 255.0 # Rescale to values between 0 and 1 (same as during training)
|
19 |
|
|
|
|
|
|
|
20 |
prediction = model.predict(img_array)
|
21 |
if prediction[0][0] > 0.5:
|
22 |
return "not a tablet"
|
|
|
13 |
model = load_model('cat_classifier_model.h5')
|
14 |
|
15 |
def predict_cat(image_pil):
|
16 |
+
img_resized = image_pil.resize((224, 224))
|
|
|
|
|
17 |
|
18 |
+
img_array = np.array(img_resized)
|
19 |
+
img_array = np.expand_dims(img_array, axis=0)
|
20 |
+
img_array = img_array / 255.0
|
21 |
prediction = model.predict(img_array)
|
22 |
if prediction[0][0] > 0.5:
|
23 |
return "not a tablet"
|