Download example.py from failed09/bashkir-roberta-token-lid: direct link, hf CLI and curl.
- Browser
- Download file 718 Bytes
-
https://huggingface.co/failed09/bashkir-roberta-token-lid/resolve/main/example.py
- Command line
-
hf download hf://failed09/bashkir-roberta-token-lid/example.py
-
curl -L -o example.py https://huggingface.co/failed09/bashkir-roberta-token-lid/resolve/main/example.py
718 Bytes
| """Download the minimal CPU release and run word-level LID.""" | |
| import importlib.util | |
| from pathlib import Path | |
| from huggingface_hub import snapshot_download | |
| directory=Path(snapshot_download("failed09/bashkir-roberta-token-lid", allow_patterns=[ | |
| "onnx/model_int8.onnx", "spm_bashkir_bert_16k.model", "config.json", "META.json", "runtime.py"])) | |
| spec=importlib.util.spec_from_file_location("bashkir_token_lid_runtime",directory/"runtime.py") | |
| runtime=importlib.util.module_from_spec(spec) | |
| spec.loader.exec_module(runtime) | |
| lid=runtime.BashkirTokenLID(directory) | |
| for token in lid.predict("Ул миңә see you tomorrow тип әйтте, значит завтра встретимся."): | |
| print(token) | |