Spaces:
Running
Running
Commit
·
15ecc3d
1
Parent(s):
736419a
app.py
CHANGED
|
@@ -76,7 +76,7 @@ def classification(text, k):
|
|
| 76 |
text = f"This vegetation plot belongs to the habitats {', '.join(habitat_labels[:-1])} and {habitat_labels[-1]}."
|
| 77 |
habitat_name = eunis_habitats[eunis_habitats['EUNIS 2020 code'] == habitat_labels[0]]['EUNIS-2021 habitat name'].values[0]
|
| 78 |
text += f"\nThe most likely habitat is '{habitat_name}'."
|
| 79 |
-
text += f"\
|
| 80 |
image_output = return_habitat_image(habitat_labels[0])
|
| 81 |
return text, image_output
|
| 82 |
|
|
@@ -122,7 +122,7 @@ def masking(text, k):
|
|
| 122 |
else:
|
| 123 |
text = f"The most likely missing species are {', '.join(best_predictions[:-1])} and {best_predictions[-1]} (positions {', '.join(map(str, best_positions[:-1]))} and {best_positions[-1]})."
|
| 124 |
text += f"\nThe new vegetation plot is {best_sentence}."
|
| 125 |
-
text += f"\
|
| 126 |
image = return_species_image(best_prediction[0])
|
| 127 |
return text, image
|
| 128 |
|
|
@@ -146,8 +146,9 @@ with gr.Blocks() as demo:
|
|
| 146 |
with gr.Tab("Missing species finding"):
|
| 147 |
gr.Markdown("""<h3 style="text-align: center;">Finding the missing species!</h3>""")
|
| 148 |
with gr.Row():
|
| 149 |
-
|
| 150 |
-
|
|
|
|
| 151 |
with gr.Column():
|
| 152 |
text_masking = gr.Textbox()
|
| 153 |
image_masking = gr.Image()
|
|
|
|
| 76 |
text = f"This vegetation plot belongs to the habitats {', '.join(habitat_labels[:-1])} and {habitat_labels[-1]}."
|
| 77 |
habitat_name = eunis_habitats[eunis_habitats['EUNIS 2020 code'] == habitat_labels[0]]['EUNIS-2021 habitat name'].values[0]
|
| 78 |
text += f"\nThe most likely habitat is '{habitat_name}'."
|
| 79 |
+
text += f"\nSee an image of this habitat ({habitat_labels[0]}) below."
|
| 80 |
image_output = return_habitat_image(habitat_labels[0])
|
| 81 |
return text, image_output
|
| 82 |
|
|
|
|
| 122 |
else:
|
| 123 |
text = f"The most likely missing species are {', '.join(best_predictions[:-1])} and {best_predictions[-1]} (positions {', '.join(map(str, best_positions[:-1]))} and {best_positions[-1]})."
|
| 124 |
text += f"\nThe new vegetation plot is {best_sentence}."
|
| 125 |
+
text += f"\nSee an image of the most likely species ({best_predictions[0]}) below."
|
| 126 |
image = return_species_image(best_prediction[0])
|
| 127 |
return text, image
|
| 128 |
|
|
|
|
| 146 |
with gr.Tab("Missing species finding"):
|
| 147 |
gr.Markdown("""<h3 style="text-align: center;">Finding the missing species!</h3>""")
|
| 148 |
with gr.Row():
|
| 149 |
+
with gr.Column():
|
| 150 |
+
species_masking = gr.Textbox(lines=2, label="Species", placeholder="Enter a list of comma-separated binomial names here.")
|
| 151 |
+
k_masking = gr.Slider(1, 5, value=1, step=1, label="Top-k", info="Choose the number of top missing species to find.")
|
| 152 |
with gr.Column():
|
| 153 |
text_masking = gr.Textbox()
|
| 154 |
image_masking = gr.Image()
|