Commit
·
d4dc3a5
1
Parent(s):
aa8dc29
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,13 +22,13 @@ def ner_tagging(text):
|
|
| 22 |
|
| 23 |
return output
|
| 24 |
|
| 25 |
-
def get_entities(
|
| 26 |
model_name = "hackathon-pln-es/jurisbert-finetuning-ner"
|
| 27 |
tokenizer = AutoTokenizer.from_pretrained(model_name, add_prefix_space=True)
|
| 28 |
|
| 29 |
model = AutoModelForTokenClassification.from_pretrained(model_name)
|
| 30 |
token_classifier = pipeline("token-classification", aggregation_strategy="simple", model=model, tokenizer=tokenizer)
|
| 31 |
-
results = token_classifier(
|
| 32 |
|
| 33 |
output = []
|
| 34 |
|
|
|
|
| 22 |
|
| 23 |
return output
|
| 24 |
|
| 25 |
+
def get_entities(example):
|
| 26 |
model_name = "hackathon-pln-es/jurisbert-finetuning-ner"
|
| 27 |
tokenizer = AutoTokenizer.from_pretrained(model_name, add_prefix_space=True)
|
| 28 |
|
| 29 |
model = AutoModelForTokenClassification.from_pretrained(model_name)
|
| 30 |
token_classifier = pipeline("token-classification", aggregation_strategy="simple", model=model, tokenizer=tokenizer)
|
| 31 |
+
results = token_classifier(example.lower())
|
| 32 |
|
| 33 |
output = []
|
| 34 |
|