from transformers import AutoTokenizer, AutoModelForTokenClassification | |
from transformers import pipeline | |
tokenizer = AutoTokenizer.from_pretrained("birgermoell/ner-swedish-wikiann") | |
model = AutoModelForTokenClassification.from_pretrained("birgermoell/ner-swedish-wikiann") | |
nlp = pipeline("ner", model=model, tokenizer=tokenizer) | |
example = "Jag heter Per och jag jobbar på KTH" | |
print(nlp(example)) | |