File size: 633 Bytes
16409df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Download and run the default CPU model from Hugging Face."""
import sys

from huggingface_hub import snapshot_download

if hasattr(sys.stdout, "reconfigure"):
    sys.stdout.reconfigure(encoding="utf-8")

model_dir = snapshot_download(
    "failed09/bashkir-roberta-ner",
    allow_patterns=["onnx/model_int8.onnx", "spm_bashkir_bert_16k.model",
                    "config.json", "runtime.py"],
)
sys.path.insert(0, model_dir)
from runtime import BashkirPersonNER  # noqa: E402

ner = BashkirPersonNER(model_dir)
print(ner.predict("Рәми Ғарипов һәм Мостай Кәрим тураһында һөйләштек."))