CesarLeblanc commited on
Commit
da4214f
·
1 Parent(s): b1a0d53

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -87,8 +87,11 @@ def masking(text):
87
  text = gbif_normalization(text)
88
  masked_text = text + ', [MASK] [MASK]'
89
  pred = mask_model(masked_text, top_k=1)
90
- new_species = [pred[i][0]['token_str'] for i in range(len(pred))]
91
- new_species = ' '.join(new_species)
 
 
 
92
  text = f"The last species from this vegetation plot is probably {new_species}."
93
  image = return_species_image(new_species)
94
  return text, image
 
87
  text = gbif_normalization(text)
88
  masked_text = text + ', [MASK] [MASK]'
89
  pred = mask_model(masked_text, top_k=1)
90
+ new_genus = pred[0][0]['token_str']
91
+ masked_text = text + f', {new_genus} [MASK]'
92
+ pred = mask_model(masked_text, top_k=1)
93
+ new_epithet = pred[0]['token_str']
94
+ new_species = new_genus + ' ' + new_epithet
95
  text = f"The last species from this vegetation plot is probably {new_species}."
96
  image = return_species_image(new_species)
97
  return text, image