Spaces:
Runtime error
Runtime error
paul hilders
commited on
Commit
·
f0f4f09
1
Parent(s):
82a35b6
Adjust NER output
Browse files
app.py
CHANGED
|
@@ -86,22 +86,18 @@ def NER_demo(image, text):
|
|
| 86 |
ent_label = ent.label_
|
| 87 |
highlighed_entities.append((ent_text, 1.0))
|
| 88 |
|
| 89 |
-
print(highlighed_entities)
|
| 90 |
-
|
| 91 |
return highlighed_entities
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
|
| 97 |
-
|
| 98 |
|
| 99 |
|
| 100 |
iface_NER = gr.Interface(fn=NER_demo,
|
| 101 |
-
inputs=
|
| 102 |
-
outputs=
|
| 103 |
-
title="CLIP Grounding Explainability",
|
| 104 |
-
description="A demonstration based on the Generic Attention-model Explainability method for Interpreting Bi-Modal Transformers by Chefer et al. (2021): https://github.com/hila-chefer/Transformer-MM-Explainability.",
|
| 105 |
examples=[["example_images/London.png", "London Eye"],
|
| 106 |
["example_images/London.png", "Big Ben"],
|
| 107 |
["example_images/harrypotter.png", "Harry"],
|
|
|
|
| 86 |
ent_label = ent.label_
|
| 87 |
highlighed_entities.append((ent_text, 1.0))
|
| 88 |
|
|
|
|
|
|
|
| 89 |
return highlighed_entities
|
| 90 |
|
| 91 |
+
input_img_NER = gr.inputs.Image(type='pil', label="Original Image")
|
| 92 |
+
input_txt_NER = "text"
|
| 93 |
+
inputs_NER = [input_img_NER, input_txt_NER]
|
| 94 |
|
| 95 |
+
outputs_NER = ["text"]
|
| 96 |
|
| 97 |
|
| 98 |
iface_NER = gr.Interface(fn=NER_demo,
|
| 99 |
+
inputs=inputs_NER,
|
| 100 |
+
outputs=outputs_NER,
|
|
|
|
|
|
|
| 101 |
examples=[["example_images/London.png", "London Eye"],
|
| 102 |
["example_images/London.png", "Big Ben"],
|
| 103 |
["example_images/harrypotter.png", "Harry"],
|