Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,11 +8,11 @@ model_path = "BMWXModelClassifier.keras"
|
|
| 8 |
model = tf.keras.models.load_model(model_path)
|
| 9 |
|
| 10 |
# Define the core prediction function
|
| 11 |
-
def
|
| 12 |
# Preprocess image
|
| 13 |
print(type(image))
|
| 14 |
image = Image.fromarray(image.astype('uint8')) # Convert numpy array to PIL image
|
| 15 |
-
image = image.resize((
|
| 16 |
image = np.array(image)
|
| 17 |
image = np.expand_dims(image, axis=0) # same as image[None, ...]
|
| 18 |
|
|
@@ -36,7 +36,7 @@ def predict_pokemon(image):
|
|
| 36 |
|
| 37 |
input_image = gr.Image()
|
| 38 |
iface = gr.Interface(
|
| 39 |
-
fn=
|
| 40 |
inputs=input_image,
|
| 41 |
outputs=gr.Label(),
|
| 42 |
description="A simple mlp classification model for image classification using the mnist dataset.")
|
|
|
|
| 8 |
model = tf.keras.models.load_model(model_path)
|
| 9 |
|
| 10 |
# Define the core prediction function
|
| 11 |
+
def predict_bmwX(image):
|
| 12 |
# Preprocess image
|
| 13 |
print(type(image))
|
| 14 |
image = Image.fromarray(image.astype('uint8')) # Convert numpy array to PIL image
|
| 15 |
+
image = image.resize((224, 224)) #resize the image to 224x224
|
| 16 |
image = np.array(image)
|
| 17 |
image = np.expand_dims(image, axis=0) # same as image[None, ...]
|
| 18 |
|
|
|
|
| 36 |
|
| 37 |
input_image = gr.Image()
|
| 38 |
iface = gr.Interface(
|
| 39 |
+
fn=predict_bmwX,
|
| 40 |
inputs=input_image,
|
| 41 |
outputs=gr.Label(),
|
| 42 |
description="A simple mlp classification model for image classification using the mnist dataset.")
|