mbar0075 commited on
Commit
899f1a4
·
1 Parent(s): 5ed11f6

Attempt fix to parish

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -138,11 +138,10 @@ def classify_image(input_image, model_name):
138
  for label, confidence in parish_predictions[:5]
139
  }
140
 
141
- # To the top prediction add "From the Parish of" + parish
142
- if len(parish_predictions) > 0:
143
- top_parish_prediction = parish_predictions[0]
144
- top_parish_label = top_parish_prediction[0]
145
- top_parish_label = f"From the Parish of {top_parish_label} / Mill-Parroċċa ta' {top_parish_label}"
146
 
147
  # Get the label with the highest confidence
148
  highest_confidence_label = predictions[0][0] # Assuming predictions are sorted by confidence
 
138
  for label, confidence in parish_predictions[:5]
139
  }
140
 
141
+ # Modify the first formatted prediction to include "From the Parish of ..."
142
+ first_label, first_confidence = parish_predictions[0]
143
+ formatted_parish_predictions[f"From the Parish of {first_label} / Mill-Parroċċa ta' {first_label}"] = formatted_parish_predictions.pop(first_label)
144
+
 
145
 
146
  # Get the label with the highest confidence
147
  highest_confidence_label = predictions[0][0] # Assuming predictions are sorted by confidence