Demo: How to use in Flair
Requires:
- Flair>=0.14.0 (
pip install flair
orpip install git+https://github.com/flairNLP/flair.git
)
from flair.data import Sentence
from flair.nn import Classifier
from flair.tokenization import SciSpacyTokenizer
# load tagger
tagger = Classifier.load("regel-corpus/hunflair2-regel-tissue")
# make example sentence
sentence = Sentence("TNF-like factor that is both produced by osteoblasts, mesenchymal cells, "
"and activated T cells and required for osteoclast maturation and survival."
use_tokenizer=SciSpacyTokenizer())
# predict NER tags
tagger.predict(sentence)
# print sentence
print(sentence)
# print predicted NER spans
print('The following NER tags are found:')
# iterate over entities and print
for entity in sentence.get_spans('ner'):
print(entity)
- Downloads last month
- 10
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.