Moaz715 commited on
Commit
dc3e797
·
1 Parent(s): 63eadff

hoping to be done

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -116,8 +116,7 @@ def preprocess_image(image, model_choice, mode_choice):
116
  return image_pca
117
  elif model_choice == "DT" or model_choice == "Logistic Regression" or model_choice == "SVM":
118
  image_hog = image_hog.reshape(1, -1)
119
- image_scaled = svm_multimode_scaler.transform(image_hog)
120
- return image_scaled
121
  elif model_choice == "KNN":
122
  image_hog = image_hog.reshape(1, -1)
123
  image_pca = pca_multi.transform(image_hog)
@@ -201,7 +200,6 @@ def classify_multimode_dt(image):
201
 
202
  def classify_multimode_svm(image):
203
  if svm_multimode_model is None:
204
- # Check if we caught a specific error for this file
205
  if 'svm_hog.pkl' in loading_errors:
206
  return f"ERROR: {loading_errors['svm_hog.pkl']}"
207
  else:
@@ -217,7 +215,8 @@ def classify_multimode_logreg(image):
217
  return "Logistic Regression Multimode model placeholder: model is not inserted yet."
218
 
219
  processed_image = preprocess_image(image, "Logistic Regression", "Multimode")
220
- prediction = logreg_multimode_model.predict(processed_image)
 
221
  return "Logistic Regression Multimode prediction: " + str(prediction[0])
222
 
223
 
 
116
  return image_pca
117
  elif model_choice == "DT" or model_choice == "Logistic Regression" or model_choice == "SVM":
118
  image_hog = image_hog.reshape(1, -1)
119
+ return image_hog
 
120
  elif model_choice == "KNN":
121
  image_hog = image_hog.reshape(1, -1)
122
  image_pca = pca_multi.transform(image_hog)
 
200
 
201
  def classify_multimode_svm(image):
202
  if svm_multimode_model is None:
 
203
  if 'svm_hog.pkl' in loading_errors:
204
  return f"ERROR: {loading_errors['svm_hog.pkl']}"
205
  else:
 
215
  return "Logistic Regression Multimode model placeholder: model is not inserted yet."
216
 
217
  processed_image = preprocess_image(image, "Logistic Regression", "Multimode")
218
+ image_scaled = svm_multimode_scaler.transform(processed_image)
219
+ prediction = logreg_multimode_model.predict(image_scaled)
220
  return "Logistic Regression Multimode prediction: " + str(prediction[0])
221
 
222