Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,9 +37,9 @@ def predict_bmwX(image):
|
|
| 37 |
prediction_dict = {class_names[i]: np.round(float(prediction[0][i]), 2) for i in range(len(class_names))}
|
| 38 |
|
| 39 |
# Sort the dictionary by value in descending order and get the top 3 classes
|
| 40 |
-
|
| 41 |
|
| 42 |
-
return
|
| 43 |
|
| 44 |
|
| 45 |
input_image = gr.Image()
|
|
|
|
| 37 |
prediction_dict = {class_names[i]: np.round(float(prediction[0][i]), 2) for i in range(len(class_names))}
|
| 38 |
|
| 39 |
# Sort the dictionary by value in descending order and get the top 3 classes
|
| 40 |
+
sorted_predictions = dict(sorted(prediction_dict.items(), key=lambda item: item[1], reverse=True))
|
| 41 |
|
| 42 |
+
return sorted_predictions
|
| 43 |
|
| 44 |
|
| 45 |
input_image = gr.Image()
|