bashkir-roberta-ner / example.py
failed09's picture
Release update
16409df verified
Raw History Blame Contribute Delete
633 Bytes
"""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("Рәми Ғарипов һәм Мостай Кәрим тураһында һөйләштек."))