Update model/model.py
Browse files- model/model.py +1 -1
model/model.py
CHANGED
|
@@ -11,7 +11,7 @@ def predict(image_path):
|
|
| 11 |
image = Image.fromarray(image_path)
|
| 12 |
image = image.convert('L')
|
| 13 |
image = image.resize((150, 150)) # Resize to match your model's input size
|
| 14 |
-
img_array = np.array(
|
| 15 |
img_array = np.expand_dims(image_array, axis=0) # Add batch dimension
|
| 16 |
prediction = model.predict(img_array)
|
| 17 |
predicted_class_index = np.argmax(prediction)
|
|
|
|
| 11 |
image = Image.fromarray(image_path)
|
| 12 |
image = image.convert('L')
|
| 13 |
image = image.resize((150, 150)) # Resize to match your model's input size
|
| 14 |
+
img_array = np.array(image) / 255.0 # Normalize pixel values
|
| 15 |
img_array = np.expand_dims(image_array, axis=0) # Add batch dimension
|
| 16 |
prediction = model.predict(img_array)
|
| 17 |
predicted_class_index = np.argmax(prediction)
|