Spaces:
Runtime error
Runtime error
CesarLeblanc
commited on
Commit
•
079e99c
1
Parent(s):
c8ce48e
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ from bs4 import BeautifulSoup
|
|
7 |
classifier = pipeline("text-classification", model="CesarLeblanc/test_model")
|
8 |
dataset = load_dataset("CesarLeblanc/text_classification_dataset")
|
9 |
|
10 |
-
def text_classification(text):
|
11 |
result = classifier(text)
|
12 |
habitat_label = result[0]['label']
|
13 |
habitat_label = dataset['train'].features['label'].names[int(habitat_label.split('_')[1])]
|
@@ -30,7 +30,7 @@ def text_classification(text):
|
|
30 |
examples=["sparganium erectum, calystegia sepium, persicaria amphibia", "thinopyrum junceum, cakile maritima"]
|
31 |
|
32 |
io = gr.Interface(fn=text_classification,
|
33 |
-
inputs=
|
34 |
outputs=[gr.Textbox(lines=2, label="Vegetation Plot Classification Result"), "image"],
|
35 |
title="Pl@ntBERT",
|
36 |
description="Vegetation Plot Classification: enter the species found in a vegetation plot and see its EUNIS habitat!",
|
|
|
7 |
classifier = pipeline("text-classification", model="CesarLeblanc/test_model")
|
8 |
dataset = load_dataset("CesarLeblanc/text_classification_dataset")
|
9 |
|
10 |
+
def text_classification(text, typology, confidence):
|
11 |
result = classifier(text)
|
12 |
habitat_label = result[0]['label']
|
13 |
habitat_label = dataset['train'].features['label'].names[int(habitat_label.split('_')[1])]
|
|
|
30 |
examples=["sparganium erectum, calystegia sepium, persicaria amphibia", "thinopyrum junceum, cakile maritima"]
|
31 |
|
32 |
io = gr.Interface(fn=text_classification,
|
33 |
+
inputs=[gr.Textbox(lines=2, label="List of comma-separated binomial names of species (see examples)", placeholder="Enter species here..."), gr.Dropdown(["EUNIS"], label="Typology", info="Will add more typologies later!"), gr.Slider(0, 100, value=50, label="Confidence", info="Choose the level of confidence for the prediction")],
|
34 |
outputs=[gr.Textbox(lines=2, label="Vegetation Plot Classification Result"), "image"],
|
35 |
title="Pl@ntBERT",
|
36 |
description="Vegetation Plot Classification: enter the species found in a vegetation plot and see its EUNIS habitat!",
|