Spaces:
Sleeping
Sleeping
Niharmahesh
commited on
Update app.py
Browse files
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(
|
45 |
probabilities[class_pred] = 1
|
46 |
|
|
|
|
|
|
|
|
|
47 |
top_index = np.argmax(probabilities)
|
48 |
-
return
|
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)
|