CesarLeblanc commited on
Commit
953601e
1 Parent(s): 7e04c05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -85,12 +85,10 @@ def masking(text, k):
85
  text_split = text.split(', ')
86
 
87
  best_predictions = []
88
- best_positions = []
89
 
90
  for _ in range(k):
91
  max_score = 0
92
  best_prediction = None
93
- best_position = None
94
  best_sentence = None
95
 
96
  for i in range(len(text_split) + 1):
@@ -111,12 +109,11 @@ def masking(text, k):
111
  if score > max_score:
112
  max_score = score
113
  best_prediction = species
114
- best_position = i
115
  best_sentence = sentence
116
 
117
  best_predictions.append(best_prediction)
118
- best_positions.append(best_position)
119
- text_split.insert(best_position, best_prediction)
120
  if k == 1:
121
  text = f"The most likely missing species is {best_predictions[0]} (position {best_positions[0]})."
122
  else:
 
85
  text_split = text.split(', ')
86
 
87
  best_predictions = []
 
88
 
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
  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: