Update app.py
Browse files
app.py
CHANGED
|
@@ -23,9 +23,7 @@ class_names = ["arrowheads", "axehammerstones", "scrapers"]
|
|
| 23 |
|
| 24 |
IMG_SIZE = (224, 224) # change this to your model's expected size
|
| 25 |
|
| 26 |
-
|
| 27 |
-
# Adjust according to your model preprocessing
|
| 28 |
-
return x / 255.0
|
| 29 |
|
| 30 |
def predict(img):
|
| 31 |
"""Predict function for Gradio"""
|
|
@@ -34,7 +32,7 @@ def predict(img):
|
|
| 34 |
x = preprocess_input(x)
|
| 35 |
x = np.expand_dims(x, 0)
|
| 36 |
preds = model.predict(x)[0]
|
| 37 |
-
top = np.argmax(preds)
|
| 38 |
return {class_names[i]: float(preds[i]) for i in range(len(preds))}
|
| 39 |
|
| 40 |
# Gradio interface
|
|
|
|
| 23 |
|
| 24 |
IMG_SIZE = (224, 224) # change this to your model's expected size
|
| 25 |
|
| 26 |
+
from tensorflow.keras.applications.efficientnet import preprocess_input
|
|
|
|
|
|
|
| 27 |
|
| 28 |
def predict(img):
|
| 29 |
"""Predict function for Gradio"""
|
|
|
|
| 32 |
x = preprocess_input(x)
|
| 33 |
x = np.expand_dims(x, 0)
|
| 34 |
preds = model.predict(x)[0]
|
| 35 |
+
# top = np.argmax(preds)
|
| 36 |
return {class_names[i]: float(preds[i]) for i in range(len(preds))}
|
| 37 |
|
| 38 |
# Gradio interface
|