add short article
Browse files
app.py
CHANGED
|
@@ -68,16 +68,16 @@ def postprocess(classifications):
|
|
| 68 |
def set_entities(sentence, entities):
|
| 69 |
doc = nlp(sentence)
|
| 70 |
ents = []
|
| 71 |
-
for
|
| 72 |
-
ents.append(doc.char_span(
|
| 73 |
doc.ents = ents
|
| 74 |
return doc
|
| 75 |
|
| 76 |
|
| 77 |
-
def apply_ner(
|
| 78 |
-
classifications = ner_pipeline(
|
| 79 |
entities = postprocess(classifications)
|
| 80 |
-
doc = set_entities(
|
| 81 |
displacy_html = displacy.render(doc, style="ent", options=options)
|
| 82 |
return displacy_html
|
| 83 |
|
|
@@ -99,6 +99,9 @@ intf = gr.Interface(fn=apply_ner, inputs="text", outputs="html", title='Slovak N
|
|
| 99 |
description="Named-entity recognition (NER) labels named-entities in unstructured text. This "
|
| 100 |
"implementation supports three labels: person (OSOBA), organization (ORGANIZΓCIA) and "
|
| 101 |
"location (LOKALITA). You can try out one of the examples below or type your own "
|
| 102 |
-
"sentence. Don't forget to use double quotes (\" \") instead of curved quotes (β β)",
|
| 103 |
-
article=""
|
|
|
|
|
|
|
|
|
|
| 104 |
intf.launch()
|
|
|
|
| 68 |
def set_entities(sentence, entities):
|
| 69 |
doc = nlp(sentence)
|
| 70 |
ents = []
|
| 71 |
+
for label, start, end in entities:
|
| 72 |
+
ents.append(doc.char_span(start, end, label))
|
| 73 |
doc.ents = ents
|
| 74 |
return doc
|
| 75 |
|
| 76 |
|
| 77 |
+
def apply_ner(Sentence: str):
|
| 78 |
+
classifications = ner_pipeline(Sentence)
|
| 79 |
entities = postprocess(classifications)
|
| 80 |
+
doc = set_entities(Sentence, entities)
|
| 81 |
displacy_html = displacy.render(doc, style="ent", options=options)
|
| 82 |
return displacy_html
|
| 83 |
|
|
|
|
| 99 |
description="Named-entity recognition (NER) labels named-entities in unstructured text. This "
|
| 100 |
"implementation supports three labels: person (OSOBA), organization (ORGANIZΓCIA) and "
|
| 101 |
"location (LOKALITA). You can try out one of the examples below or type your own "
|
| 102 |
+
"sentence. Don't forget to use double quotes (\" \") instead of curved quotes (β β).",
|
| 103 |
+
article="This model is a fine-tuned version of [gerulata/slovakbert]"
|
| 104 |
+
"(https://huggingface.co/gerulata/slovakbert) on the Slovak wikiann dataset. It achieves "
|
| 105 |
+
"F1 score of 0.9398 on the evaluation set. The quote requirements comes from pretrained "
|
| 106 |
+
"SlovakBERT and was not introduced by me.")
|
| 107 |
intf.launch()
|