Spaces:
Running
Running
CesarLeblanc
commited on
Commit
•
b8df8bd
1
Parent(s):
e2c9e6d
Update app.py
Browse files
app.py
CHANGED
@@ -57,8 +57,8 @@ def return_species_image(species):
|
|
57 |
image = gr.Image(value=image_url)
|
58 |
return image
|
59 |
|
60 |
-
def classification(text, typology, confidence
|
61 |
-
model = return_model(
|
62 |
dataset = return_dataset()
|
63 |
result = model(text)
|
64 |
habitat_label = result[0]['label']
|
@@ -68,8 +68,8 @@ def classification(text, typology, confidence, task):
|
|
68 |
image_output = return_habitat_image(habitat_label, habitat_score, confidence)
|
69 |
return formatted_output, image_output
|
70 |
|
71 |
-
def masking(text
|
72 |
-
model = return_model(
|
73 |
masked_text = text + ', [MASK] [MASK]'
|
74 |
pred = model(masked_text, top_k=1)
|
75 |
new_species = [pred[i][0]['token_str'] for i in range(len(pred))]
|
@@ -84,14 +84,13 @@ with gr.Blocks() as demo:
|
|
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 |
-
|
88 |
-
|
89 |
-
|
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")
|
|
|
57 |
image = gr.Image(value=image_url)
|
58 |
return image
|
59 |
|
60 |
+
def classification(text, typology, confidence):
|
61 |
+
model = return_model("classification")
|
62 |
dataset = return_dataset()
|
63 |
result = model(text)
|
64 |
habitat_label = result[0]['label']
|
|
|
68 |
image_output = return_habitat_image(habitat_label, habitat_score, confidence)
|
69 |
return formatted_output, image_output
|
70 |
|
71 |
+
def masking(text):
|
72 |
+
model = return_model("masking")
|
73 |
masked_text = text + ', [MASK] [MASK]'
|
74 |
pred = model(masked_text, top_k=1)
|
75 |
new_species = [pred[i][0]['token_str'] for i in range(len(pred))]
|
|
|
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 |
+
with gr.Row():
|
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 |
+
species_2 = gr.Textbox(lines=2, label="Species", placeholder="Enter a list of comma-separated binomial names here.")
|
93 |
with gr.Row():
|
|
|
|
|
94 |
image_output_1 = gr.Textbox()
|
95 |
image_output_2 = gr.Image()
|
96 |
image_button = gr.Button("Find")
|