Spaces:
Running
Running
Commit
·
22a6037
1
Parent(s):
c80713a
Update app.py
Browse files
app.py
CHANGED
@@ -82,6 +82,10 @@ def make_prediction(image, taxonomic_decision, taxonomic_level):
|
|
82 |
|
83 |
current_level_index += 1 # Move to the next taxonomic level
|
84 |
|
|
|
|
|
|
|
|
|
85 |
# Get the predicted class name for the top prediction
|
86 |
predicted_class_index = np.argmax(aggregated_predictions)
|
87 |
predicted_class_name = aggregated_class_labels[predicted_class_index]
|
|
|
82 |
|
83 |
current_level_index += 1 # Move to the next taxonomic level
|
84 |
|
85 |
+
# Check if a valid prediction was made
|
86 |
+
if current_level_index == len(taxonomic_levels):
|
87 |
+
return "Unknown animal" # No valid predictions met the confidence criteria
|
88 |
+
|
89 |
# Get the predicted class name for the top prediction
|
90 |
predicted_class_index = np.argmax(aggregated_predictions)
|
91 |
predicted_class_name = aggregated_class_labels[predicted_class_index]
|