Spaces:
Running
Running
CesarLeblanc
commited on
Commit
•
f5a3585
1
Parent(s):
ccf126e
Update app.py
Browse files
app.py
CHANGED
@@ -36,6 +36,7 @@ def return_habitat_image(habitat_label, habitat_score, confidence):
|
|
36 |
image_url = "https://www.salonlfc.com/wp-content/uploads/2018/01/image-not-found-scaled-1150x647.png"
|
37 |
if habitat_score*100 < confidence:
|
38 |
image_url = "https://www.salonlfc.com/wp-content/uploads/2018/01/image-not-found-scaled-1150x647.png"
|
|
|
39 |
image = gr.Image(value=image_url)
|
40 |
return image
|
41 |
|
@@ -52,6 +53,7 @@ def return_species_image(species):
|
|
52 |
image_url = "https://www.salonlfc.com/wp-content/uploads/2018/01/image-not-found-scaled-1150x647.png"
|
53 |
else:
|
54 |
image_url = "https://www.salonlfc.com/wp-content/uploads/2018/01/image-not-found-scaled-1150x647.png"
|
|
|
55 |
image = gr.Image(value=image_url)
|
56 |
return image
|
57 |
|
@@ -72,7 +74,7 @@ def masking(text, task):
|
|
72 |
pred = model(masked_text, top_k=1)
|
73 |
new_species = [pred[i][0]['token_str'] for i in range(len(pred))]
|
74 |
new_species = ' '.join(new_species)
|
75 |
-
text =
|
76 |
image = return_species_image(new_species)
|
77 |
return text, image
|
78 |
|
|
|
36 |
image_url = "https://www.salonlfc.com/wp-content/uploads/2018/01/image-not-found-scaled-1150x647.png"
|
37 |
if habitat_score*100 < confidence:
|
38 |
image_url = "https://www.salonlfc.com/wp-content/uploads/2018/01/image-not-found-scaled-1150x647.png"
|
39 |
+
image_url = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQoQPZxckzsiQyFh9w7Z7aJ38d23lvLQFj4QemMFjw2lvc18iQrzDYf7EzzmD7cFdfbsZU&usqp=CAU"
|
40 |
image = gr.Image(value=image_url)
|
41 |
return image
|
42 |
|
|
|
53 |
image_url = "https://www.salonlfc.com/wp-content/uploads/2018/01/image-not-found-scaled-1150x647.png"
|
54 |
else:
|
55 |
image_url = "https://www.salonlfc.com/wp-content/uploads/2018/01/image-not-found-scaled-1150x647.png"
|
56 |
+
image_url = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQoQPZxckzsiQyFh9w7Z7aJ38d23lvLQFj4QemMFjw2lvc18iQrzDYf7EzzmD7cFdfbsZU&usqp=CAU"
|
57 |
image = gr.Image(value=image_url)
|
58 |
return image
|
59 |
|
|
|
74 |
pred = model(masked_text, top_k=1)
|
75 |
new_species = [pred[i][0]['token_str'] for i in range(len(pred))]
|
76 |
new_species = ' '.join(new_species)
|
77 |
+
text = f"The last species from this vegetation plot is probably {new_species}."
|
78 |
image = return_species_image(new_species)
|
79 |
return text, image
|
80 |
|