Spaces:
Sleeping
Sleeping
Create models/load_models.py
Browse files- models/load_models.py +10 -0
models/load_models.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import spacy
|
2 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
|
3 |
+
|
4 |
+
# Load SpaCy model
|
5 |
+
nlp_spacy = spacy.load('en_core_web_sm')
|
6 |
+
|
7 |
+
# Load NER model
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained("Babelscape/wikineural-multilingual-ner")
|
9 |
+
model = AutoModelForTokenClassification.from_pretrained("Babelscape/wikineural-multilingual-ner")
|
10 |
+
nlp_ner = pipeline('ner', model=model, tokenizer=tokenizer, aggregation_strategy="simple")
|