Mhammad Ibrahim commited on
Commit
f4ce35e
·
1 Parent(s): 17d7918
Files changed (1) hide show
  1. app.py +3 -3
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, device="cpu")
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)