andrewzamp commited on
Commit
9669b45
·
1 Parent(s): e375d50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -86,8 +86,11 @@ def make_prediction(image, taxonomic_resolution_choice, taxonomic_level):
86
  # Move to the next higher taxonomic level
87
  current_taxonomic_level_index += 1
88
 
89
- # Update the taxonomic level for output
90
- taxonomic_level = taxonomic_levels[current_taxonomic_level_index]
 
 
 
91
  else:
92
  # Aggregate predictions based on the selected taxonomic level
93
  aggregated_predictions, aggregated_class_labels = aggregate_predictions(prediction, taxonomic_level, class_names)
 
86
  # Move to the next higher taxonomic level
87
  current_taxonomic_level_index += 1
88
 
89
+ # Ensure we don't go out of bounds
90
+ if current_taxonomic_level_index < len(taxonomic_levels):
91
+ taxonomic_level = taxonomic_levels[current_taxonomic_level_index]
92
+ else:
93
+ taxonomic_level = taxonomic_levels[-1] # fallback to the highest taxonomic level
94
  else:
95
  # Aggregate predictions based on the selected taxonomic level
96
  aggregated_predictions, aggregated_class_labels = aggregate_predictions(prediction, taxonomic_level, class_names)