amirTamer commited on
Commit
ed82302
·
1 Parent(s): 8e9a321
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -21,7 +21,7 @@ def load_pickle_file(file_name):
21
  print("Loading GNB model... (this might take a few seconds)")
22
  gnb_package = load_pickle_file("gnb_digit6_package.pkl")
23
  pca_multi = load_pickle_file("pcaMulti.pkl")
24
- rf_model = load_pickle_file("")
25
  pca_multi = pca_multi['pca']
26
 
27
  if gnb_package is not None:
@@ -199,7 +199,8 @@ def classify_multimode_knn(image):
199
 
200
  def classify_rf(image):
201
  processed_image = preprocess_image(image , "DT" , "Multimode")
202
- prediction = knn_multimode_model.predict(processed_image)
 
203
 
204
 
205
  def predict_with_selected_model(image, model_choice, mode_choice):
@@ -249,7 +250,7 @@ demo = gr.Interface(
249
  label="Upload Digit Image"
250
  ),
251
  gr.Radio(
252
- choices=["GNB", "DT", "SVM", "Logistic Regression", "KNN"],
253
  value="GNB",
254
  label="Choose Model Type"
255
  ),
 
21
  print("Loading GNB model... (this might take a few seconds)")
22
  gnb_package = load_pickle_file("gnb_digit6_package.pkl")
23
  pca_multi = load_pickle_file("pcaMulti.pkl")
24
+ rf_model = load_pickle_file("rf_hog_model")
25
  pca_multi = pca_multi['pca']
26
 
27
  if gnb_package is not None:
 
199
 
200
  def classify_rf(image):
201
  processed_image = preprocess_image(image , "DT" , "Multimode")
202
+ prediction = rf_model.predict(processed_image)
203
+ return "RF Prediction: " + str(prediction[0])
204
 
205
 
206
  def predict_with_selected_model(image, model_choice, mode_choice):
 
250
  label="Upload Digit Image"
251
  ),
252
  gr.Radio(
253
+ choices=["GNB", "DT", "SVM", "Logistic Regression", "KNN" , "Random Forest"],
254
  value="GNB",
255
  label="Choose Model Type"
256
  ),