Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,6 @@ def extract_resnet_features(image_data):
|
|
26 |
x = image.img_to_array(img)
|
27 |
x = np.expand_dims(x, axis=0)
|
28 |
x = preprocess_input(x)
|
29 |
-
|
30 |
# Extract features using ResNet50
|
31 |
features = base_model.predict(x)
|
32 |
features_flattened = features.flatten()
|
@@ -39,7 +38,7 @@ def predict(image):
|
|
39 |
features = extract_resnet_features(image)
|
40 |
|
41 |
# Make prediction using Random Forest classifier
|
42 |
-
predicted_index = rf_classifier.predict([
|
43 |
|
44 |
# Decode predicted class using the class labels obtained from the Random Forest classifier
|
45 |
predicted_class = class_labels[predicted_index]
|
|
|
26 |
x = image.img_to_array(img)
|
27 |
x = np.expand_dims(x, axis=0)
|
28 |
x = preprocess_input(x)
|
|
|
29 |
# Extract features using ResNet50
|
30 |
features = base_model.predict(x)
|
31 |
features_flattened = features.flatten()
|
|
|
38 |
features = extract_resnet_features(image)
|
39 |
|
40 |
# Make prediction using Random Forest classifier
|
41 |
+
predicted_index = rf_classifier.predict([features])[0]
|
42 |
|
43 |
# Decode predicted class using the class labels obtained from the Random Forest classifier
|
44 |
predicted_class = class_labels[predicted_index]
|