Spaces:
Sleeping
Sleeping
Commit
·
1c2f25a
1
Parent(s):
7e0319c
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,16 +10,17 @@ def text_classification(text):
|
|
| 10 |
habitat_label = result[0]['label']
|
| 11 |
habitat_label = dataset['train'].features['label'].names[int(habitat_label.split('_')[1])]
|
| 12 |
habitat_score = result[0]['score']
|
| 13 |
-
formatted_output = f"This vegetation plot
|
| 14 |
-
|
|
|
|
| 15 |
|
| 16 |
-
examples=["
|
| 17 |
|
| 18 |
io = gr.Interface(fn=text_classification,
|
| 19 |
-
inputs= gr.Textbox(lines=2, label="
|
| 20 |
-
outputs=gr.Textbox(lines=2, label="
|
| 21 |
-
title="
|
| 22 |
-
description="
|
| 23 |
examples=examples)
|
| 24 |
|
| 25 |
io.launch()
|
|
|
|
| 10 |
habitat_label = result[0]['label']
|
| 11 |
habitat_label = dataset['train'].features['label'].names[int(habitat_label.split('_')[1])]
|
| 12 |
habitat_score = result[0]['score']
|
| 13 |
+
formatted_output = f"This vegetation plot belongs to the habitat {habitat_label} with the probability {habitat_score*100:.2f}%"
|
| 14 |
+
image_output = gr.Image(value='N13.jpg', type="filepath")
|
| 15 |
+
return formatted_output, image_output
|
| 16 |
|
| 17 |
+
examples=["sparganium erectum, calystegia sepium, persicaria amphibia", "thinopyrum junceum, cakile maritima"]
|
| 18 |
|
| 19 |
io = gr.Interface(fn=text_classification,
|
| 20 |
+
inputs= gr.Textbox(lines=2, label="List of comma-separated binomial names of species (see examples)", placeholder="Enter species here..."),
|
| 21 |
+
outputs=[gr.Textbox(lines=2, label="Vegetation Plot Classification Result"), "image"],
|
| 22 |
+
title="Pl@ntBERT",
|
| 23 |
+
description="Vegetation Plot Classification: enter the species found in a vegetation plot and see its EUNIS habitat!",
|
| 24 |
examples=examples)
|
| 25 |
|
| 26 |
io.launch()
|