CesarLeblanc commited on
Commit
60270f6
·
verified ·
1 Parent(s): d3e6e3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -72,6 +72,7 @@ def classification(text, k):
72
  text = gbif_normalization(text)
73
  result = classification_model(text)
74
  habitat_labels = [res['label'] for res in result[0][:k]]
 
75
  if k == 1:
76
  text = f"This vegetation plot probably belongs to the habitat type {habitat_labels[0]}."
77
  text += f"\nThis habitat type is named '{habitat_name}'."
@@ -81,7 +82,6 @@ def classification(text, k):
81
  else:
82
  text = f"This vegetation plot probably belongs to the habitat type {', '.join(habitat_labels[:-1])}, or {habitat_labels[-1]}."
83
  text += f"\nThe most likely habitat type (i.e., habitat_labels[0]) is named '{habitat_name}'."
84
- habitat_name = eunis_habitats[eunis_habitats['EUNIS 2020 code'] == habitat_labels[0]]['EUNIS-2021 habitat name'].values[0]
85
  text += f"\nSee an image of this habitat type below."
86
  image_output = return_habitat_image(habitat_labels[0])
87
  return text, image_output
 
72
  text = gbif_normalization(text)
73
  result = classification_model(text)
74
  habitat_labels = [res['label'] for res in result[0][:k]]
75
+ habitat_name = eunis_habitats[eunis_habitats['EUNIS 2020 code'] == habitat_labels[0]]['EUNIS-2021 habitat name'].values[0]
76
  if k == 1:
77
  text = f"This vegetation plot probably belongs to the habitat type {habitat_labels[0]}."
78
  text += f"\nThis habitat type is named '{habitat_name}'."
 
82
  else:
83
  text = f"This vegetation plot probably belongs to the habitat type {', '.join(habitat_labels[:-1])}, or {habitat_labels[-1]}."
84
  text += f"\nThe most likely habitat type (i.e., habitat_labels[0]) is named '{habitat_name}'."
 
85
  text += f"\nSee an image of this habitat type below."
86
  image_output = return_habitat_image(habitat_labels[0])
87
  return text, image_output