Spaces:
Sleeping
Sleeping
Mhammad Ibrahim
commited on
Commit
·
f4ce35e
1
Parent(s):
17d7918
update
Browse files
app.py
CHANGED
|
@@ -11,11 +11,11 @@ import torch
|
|
| 11 |
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
|
| 12 |
|
| 13 |
# Load model and tokenizer from Hugging Face Hub
|
| 14 |
-
tokenizer = AutoTokenizer.from_pretrained("Mhammad2023/bert-finetuned-ner")
|
| 15 |
model = AutoModelForTokenClassification.from_pretrained(
|
| 16 |
-
"Mhammad2023/bert-finetuned-ner"
|
| 17 |
)
|
| 18 |
-
classifier = pipeline("token-classification", model=model, tokenizer=tokenizer,
|
| 19 |
|
| 20 |
def predict(text):
|
| 21 |
results = classifier(text)
|
|
|
|
| 11 |
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
|
| 12 |
|
| 13 |
# Load model and tokenizer from Hugging Face Hub
|
| 14 |
+
tokenizer = AutoTokenizer.from_pretrained("Mhammad2023/bert-finetuned-ner-torch")
|
| 15 |
model = AutoModelForTokenClassification.from_pretrained(
|
| 16 |
+
"Mhammad2023/bert-finetuned-ner-torch"
|
| 17 |
)
|
| 18 |
+
classifier = pipeline("token-classification", model=model, tokenizer=tokenizer, aggregation_strategy="simple")
|
| 19 |
|
| 20 |
def predict(text):
|
| 21 |
results = classifier(text)
|