Spaces:
Running
Running
label legend
Browse files- interfaces/ner.py +2 -2
interfaces/ner.py
CHANGED
@@ -9,7 +9,7 @@ from transformers import AutoModelForSequenceClassification
|
|
9 |
from transformers import AutoTokenizer
|
10 |
from huggingface_hub import HfApi
|
11 |
|
12 |
-
from
|
13 |
|
14 |
languages = [
|
15 |
"English", "Hungarian", "Multilingual"
|
@@ -40,7 +40,7 @@ def named_entity_recognition(text, language):
|
|
40 |
legend = '<p style="text-align: left; display: block">Legend:</p><ul style="text-align: left; display: block">'+"".join([f"<li> <b>{label}</b> = <i>{NER_DICT[label]}</i> </li>" for label in set(labels_used)])+"</ul>"
|
41 |
output = {"text":text, "entities":entities}
|
42 |
model_id_hf = f"huspacy/{model_id}" if model_id.startswith("hu") else f"spacy/{model_id}"
|
43 |
-
output_info = legend + f'<p style="text-align: center; display: block">Prediction was made using the <a href="https://huggingface.co/{model_id_hf}">{model_id_hf}</a> model.</p> <ul>
|
44 |
return output, output_info
|
45 |
|
46 |
demo = gr.Interface(
|
|
|
9 |
from transformers import AutoTokenizer
|
10 |
from huggingface_hub import HfApi
|
11 |
|
12 |
+
from spacy.glossary import GLOSSARY as NER_DICT
|
13 |
|
14 |
languages = [
|
15 |
"English", "Hungarian", "Multilingual"
|
|
|
40 |
legend = '<p style="text-align: left; display: block">Legend:</p><ul style="text-align: left; display: block">'+"".join([f"<li> <b>{label}</b> = <i>{NER_DICT[label]}</i> </li>" for label in set(labels_used)])+"</ul>"
|
41 |
output = {"text":text, "entities":entities}
|
42 |
model_id_hf = f"huspacy/{model_id}" if model_id.startswith("hu") else f"spacy/{model_id}"
|
43 |
+
output_info = legend + f'<p style="text-align: center; display: block">Prediction was made using the <a href="https://huggingface.co/{model_id_hf}">{model_id_hf}</a> model.</p> <ul>'
|
44 |
return output, output_info
|
45 |
|
46 |
demo = gr.Interface(
|