Spaces:
Running
Running
CesarLeblanc
commited on
Commit
•
5282aca
1
Parent(s):
f5a3585
Update app.py
Browse files
app.py
CHANGED
@@ -78,39 +78,25 @@ def masking(text, task):
|
|
78 |
image = return_species_image(new_species)
|
79 |
return text, image
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
gr.
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
]
|
99 |
-
|
100 |
-
title="Pl@ntBERT"
|
101 |
-
|
102 |
-
description="Vegetation Plot Classification: enter the species found in a vegetation plot and see its EUNIS habitat!"
|
103 |
-
|
104 |
-
examples=[
|
105 |
-
["sparganium erectum, calystegia sepium, persicaria amphibia", "EUNIS", 90, "classification"],
|
106 |
-
["vaccinium myrtillus, dryopteris dilatata, molinia caerulea", "EUNIS", 90, "masking"]
|
107 |
-
]
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
outputs=outputs,
|
112 |
-
title=title,
|
113 |
-
description=description,
|
114 |
-
examples=examples)
|
115 |
|
116 |
-
|
|
|
78 |
image = return_species_image(new_species)
|
79 |
return text, image
|
80 |
|
81 |
+
with gr.Blocks() as demo:
|
82 |
+
gr.Markdown("Classify vegetation plots or find the missing species.")
|
83 |
+
with gr.Tab("Vegetation plot classification"):
|
84 |
+
species = gr.Textbox(lines=2, label="Species", placeholder="Enter a list of comma-separated binomial names here.")
|
85 |
+
typology = gr.Dropdown(["EUNIS"], value="EUNIS", label="Typology", info="Will add more typologies later!")
|
86 |
+
confidence = gr.Slider(0, 100, value=90, label="Confidence", info="Choose the level of confidence for the prediction.")
|
87 |
+
task = gr.Radio(["classification", "masking"], value="classification", label="Task", info="Which task to choose?")
|
88 |
+
text_output_1 = gr.Textbox()
|
89 |
+
text_output_2 = gr.Image()
|
90 |
+
text_button = gr.Button("Classify")
|
91 |
+
with gr.Tab("Missing species finding"):
|
92 |
+
with gr.Row():
|
93 |
+
species_2 = gr.Textbox(lines=2, label="Species", placeholder="Enter a list of comma-separated binomial names here.")
|
94 |
+
task_2 = gr.Radio(["classification", "masking"], value="classification", label="Task", info="Which task to choose?")
|
95 |
+
image_output_1 = gr.Textbox()
|
96 |
+
image_output_2 = gr.Image()
|
97 |
+
image_button = gr.Button("Find")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
+
text_button.click(classification, inputs=[species, typology, confidence, task], outputs=[text_output_1, text_output_2]])
|
100 |
+
image_button.click(masking, inputs=[species_2, task_2], outputs=[image_output_1, image_output_2]])
|
|
|
|
|
|
|
|
|
101 |
|
102 |
+
demo.launch()
|