Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,11 +107,11 @@ def masking(text, k):
|
|
| 107 |
best_sentence = ", ".join([s.strip().capitalize() for s in best_sentence.split(",")])
|
| 108 |
|
| 109 |
if k == 1:
|
| 110 |
-
text = f"The most likely missing species is {best_predictions} (position {best_positions[0]})."
|
| 111 |
elif k == 2:
|
| 112 |
-
text = f"The most likely missing species are {best_predictions[0]} and {best_predictions[1]} (positions {best_positions[0]} and {best_positions[1]})."
|
| 113 |
else:
|
| 114 |
-
text = f"The most likely missing species are
|
| 115 |
text += f"\nThe completed vegetation plot is thus '{best_sentence}'."
|
| 116 |
image = return_image("masking", best_predictions[0])
|
| 117 |
if image is not None:
|
|
|
|
| 107 |
best_sentence = ", ".join([s.strip().capitalize() for s in best_sentence.split(",")])
|
| 108 |
|
| 109 |
if k == 1:
|
| 110 |
+
text = f"The most likely missing species is '{best_predictions[0]}' (position {best_positions[0]})."
|
| 111 |
elif k == 2:
|
| 112 |
+
text = f"The most likely missing species are '{best_predictions[0]}' and '{best_predictions[1]}' (positions {best_positions[0]} and {best_positions[1]})."
|
| 113 |
else:
|
| 114 |
+
text = f"The most likely missing species are " + ', '.join(f"'{s}'" for s in best_predictions[:-1]) + f", and '{best_predictions[-1]}' (positions {', '.join(map(str, best_positions[:-1]))}, and {best_positions[-1]})."
|
| 115 |
text += f"\nThe completed vegetation plot is thus '{best_sentence}'."
|
| 116 |
image = return_image("masking", best_predictions[0])
|
| 117 |
if image is not None:
|