Spaces:
Sleeping
Sleeping
Me3za
Browse files
app.py
CHANGED
|
@@ -178,11 +178,9 @@ def classify_multimode_logreg(image):
|
|
| 178 |
|
| 179 |
|
| 180 |
def classify_multimode_knn(image):
|
| 181 |
-
if knn_multimode_model is None:
|
| 182 |
-
return "KNN Multimode model placeholder: model is not inserted yet."
|
| 183 |
|
| 184 |
-
processed_image = preprocess_image(image, "KNN", "
|
| 185 |
-
prediction =
|
| 186 |
return "KNN Multimode prediction: " + str(prediction[0])
|
| 187 |
|
| 188 |
def classify_rf(image):
|
|
@@ -219,7 +217,7 @@ def predict_with_selected_model(image, model_choice, mode_choice):
|
|
| 219 |
elif model_choice == "Logistic Regression":
|
| 220 |
return classify_multimode_logreg(image)
|
| 221 |
elif model_choice == "KNN":
|
| 222 |
-
return
|
| 223 |
elif model_choice == "Random Forest":
|
| 224 |
return classify_rf(image)
|
| 225 |
else:
|
|
|
|
| 178 |
|
| 179 |
|
| 180 |
def classify_multimode_knn(image):
|
|
|
|
|
|
|
| 181 |
|
| 182 |
+
processed_image = preprocess_image(image, "KNN", "Binary")
|
| 183 |
+
prediction = knn_model.predict(processed_image)
|
| 184 |
return "KNN Multimode prediction: " + str(prediction[0])
|
| 185 |
|
| 186 |
def classify_rf(image):
|
|
|
|
| 217 |
elif model_choice == "Logistic Regression":
|
| 218 |
return classify_multimode_logreg(image)
|
| 219 |
elif model_choice == "KNN":
|
| 220 |
+
return classify_multimode_knn(image)
|
| 221 |
elif model_choice == "Random Forest":
|
| 222 |
return classify_rf(image)
|
| 223 |
else:
|