CesarLeblanc commited on
Commit
3218b1a
1 Parent(s): e39af65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -89,6 +89,7 @@ def masking(text, k):
89
  for _ in range(k):
90
  max_score = 0
91
  best_prediction = None
 
92
  best_sentence = None
93
 
94
  for i in range(len(text_split) + 1):
@@ -109,11 +110,14 @@ def masking(text, k):
109
  if score > max_score:
110
  max_score = score
111
  best_prediction = species
 
112
  best_sentence = sentence
113
 
114
  best_predictions.append(best_prediction)
115
- text_split.insert(i, best_prediction)
116
- best_positions = [text_split.index(prediction) for prediction in best_predictions]
 
 
117
  if k == 1:
118
  text = f"The most likely missing species is {best_predictions[0]} (position {best_positions[0]})."
119
  else:
 
89
  for _ in range(k):
90
  max_score = 0
91
  best_prediction = None
92
+ best_position = None
93
  best_sentence = None
94
 
95
  for i in range(len(text_split) + 1):
 
110
  if score > max_score:
111
  max_score = score
112
  best_prediction = species
113
+ best_position = i
114
  best_sentence = sentence
115
 
116
  best_predictions.append(best_prediction)
117
+ text_split.insert(best_position, best_prediction)
118
+
119
+ best_positions = [text_split.index(prediction) for prediction in best_predictions]
120
+
121
  if k == 1:
122
  text = f"The most likely missing species is {best_predictions[0]} (position {best_positions[0]})."
123
  else: