Spaces:
Runtime error
Runtime error
Commit
Β·
13d7daa
1
Parent(s):
1e516ec
added xlm roberta and changed TryNER to TaNER
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
-
from transformers import AutoTokenizer, AutoModelForTokenClassification,pipeline
|
4 |
|
5 |
def get_ner_bio(pipe,text):
|
6 |
tok_text = pipe.tokenizer(text, return_tensors='pt')
|
@@ -35,11 +35,12 @@ def get_ner(pipe,text,aggregation_strategy="first"):
|
|
35 |
return {"text": text, "entities": results}
|
36 |
|
37 |
ner_models = [
|
38 |
-
"livinNector/
|
39 |
-
"livinNector/
|
40 |
"livinNector/IndicBERTNER",
|
41 |
"livinNector/IndicNER",
|
42 |
"ai4bharat/IndicNER",
|
|
|
43 |
"livinNector/distilbert-multilingual-base-ner"
|
44 |
]
|
45 |
ner_pipes = [pipeline("token-classification",model) for model in ner_models]
|
@@ -57,7 +58,7 @@ iface = gr.Interface(
|
|
57 |
get_ner_outputs,
|
58 |
[
|
59 |
gr.Textbox(value=examples[0][0]),
|
60 |
-
gr.Dropdown(["bio_first","first","max","average"],value=examples[0][1])
|
61 |
],
|
62 |
[gr.Highlight(label=model) for model in ner_models],
|
63 |
description='Named Entity Recongnition Interface Comparing Various Transformer Based NER models for Tamil Language.',
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
|
4 |
|
5 |
def get_ner_bio(pipe,text):
|
6 |
tok_text = pipe.tokenizer(text, return_tensors='pt')
|
|
|
35 |
return {"text": text, "entities": results}
|
36 |
|
37 |
ner_models = [
|
38 |
+
"livinNector/TaNER-500",
|
39 |
+
"livinNector/TaNER-1k",
|
40 |
"livinNector/IndicBERTNER",
|
41 |
"livinNector/IndicNER",
|
42 |
"ai4bharat/IndicNER",
|
43 |
+
"livinNector/xlm-roberta-base-ner",
|
44 |
"livinNector/distilbert-multilingual-base-ner"
|
45 |
]
|
46 |
ner_pipes = [pipeline("token-classification",model) for model in ner_models]
|
|
|
58 |
get_ner_outputs,
|
59 |
[
|
60 |
gr.Textbox(value=examples[0][0]),
|
61 |
+
gr.Dropdown(["bio_first", "first", "max", "average"],value=examples[0][1])
|
62 |
],
|
63 |
[gr.Highlight(label=model) for model in ner_models],
|
64 |
description='Named Entity Recongnition Interface Comparing Various Transformer Based NER models for Tamil Language.',
|