Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,7 @@ labels = [
|
|
| 17 |
|
| 18 |
def predict(image):
|
| 19 |
image = np.array(image) # Ensure image is a numpy array
|
| 20 |
-
image =
|
| 21 |
image = image / 255.0 # Normalize the image if your model expects pixel values in [0, 1]
|
| 22 |
image = np.expand_dims(image, axis=0) # Add batch dimension
|
| 23 |
|
|
@@ -33,7 +33,7 @@ def predict(image):
|
|
| 33 |
|
| 34 |
# Create Gradio interface
|
| 35 |
iface = gr.Interface(fn=predict,
|
| 36 |
-
inputs=gr.inputs.Image
|
| 37 |
outputs="text",
|
| 38 |
title="Fruit Quality Classifier",
|
| 39 |
description="Upload an image to classify it as fresh or rotten fruit.")
|
|
|
|
| 17 |
|
| 18 |
def predict(image):
|
| 19 |
image = np.array(image) # Ensure image is a numpy array
|
| 20 |
+
image = image.reshape((-1, 300, 300, 3)) # Resize the image to match model input
|
| 21 |
image = image / 255.0 # Normalize the image if your model expects pixel values in [0, 1]
|
| 22 |
image = np.expand_dims(image, axis=0) # Add batch dimension
|
| 23 |
|
|
|
|
| 33 |
|
| 34 |
# Create Gradio interface
|
| 35 |
iface = gr.Interface(fn=predict,
|
| 36 |
+
inputs=gr.inputs.Image,
|
| 37 |
outputs="text",
|
| 38 |
title="Fruit Quality Classifier",
|
| 39 |
description="Upload an image to classify it as fresh or rotten fruit.")
|