Niharmahesh commited on
Commit
313ea3a
·
verified ·
1 Parent(s): d08637a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -41,11 +41,15 @@ def get_model_predictions(data_aux, model):
41
  probabilities = (scores - scores.min()) / (scores.max() - scores.min())
42
  else:
43
  class_pred = model.predict([data_aux])[0]
44
- probabilities = np.zeros(len(label_encoder.classes_))
45
  probabilities[class_pred] = 1
46
 
 
 
 
 
47
  top_index = np.argmax(probabilities)
48
- return label_encoder.inverse_transform([top_index])[0], probabilities[top_index]
49
 
50
  def predict_alphabet(image):
51
  image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
 
41
  probabilities = (scores - scores.min()) / (scores.max() - scores.min())
42
  else:
43
  class_pred = model.predict([data_aux])[0]
44
+ probabilities = np.zeros(len(label_classes))
45
  probabilities[class_pred] = 1
46
 
47
+ # Add this check
48
+ if not hasattr(model, 'monotonic_cst'):
49
+ model.monotonic_cst = None
50
+
51
  top_index = np.argmax(probabilities)
52
+ return label_classes[top_index], probabilities[top_index]
53
 
54
  def predict_alphabet(image):
55
  image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)