CesarLeblanc commited on
Commit
1c2f25a
1 Parent(s): 7e0319c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
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 is {habitat_label} with the probability {habitat_score*100:.2f}%"
14
- return formatted_output
 
15
 
16
- examples=["quercus robur, betula pendula, holcus lanatus, lonicera periclymenum, carex arenaria, poa trivialis", "thinopyrum junceum, cakile maritima"]
17
 
18
  io = gr.Interface(fn=text_classification,
19
- inputs= gr.Textbox(lines=2, label="Text", placeholder="Enter species here..."),
20
- outputs=gr.Textbox(lines=2, label="Text Classification Result"),
21
- title="Vegetation Plot Classification",
22
- description="Enter the species and see the vegetation plot classification result!",
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()