Download examples/classify_prompt.py from TakamaruAI/Skala: direct link, hf CLI and curl.
- Browser
- Download file 636 Bytes
-
https://huggingface.co/TakamaruAI/Skala/resolve/main/examples/classify_prompt.py
- Command line
-
hf download hf://TakamaruAI/Skala/examples/classify_prompt.py
-
curl -L -o classify_prompt.py https://huggingface.co/TakamaruAI/Skala/resolve/main/examples/classify_prompt.py
636 Bytes
| import os | |
| import sys | |
| ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| sys.path.insert(0, ROOT) | |
| from skala import SkalaClassifier | |
| def main() -> int: | |
| default = "I have this Python codebase, can you port it to C++" | |
| text = " ".join(sys.argv[1:]) or default | |
| classifier = SkalaClassifier(os.path.join(ROOT, "artifacts")) | |
| classifier.load() | |
| classifier.warmup() | |
| label, scores = classifier.classify(text) | |
| print(f"{text!r} -> {label}") | |
| for name in ("simple", "medium", "complex"): | |
| print(f" {name}: {scores[name]:.3f}") | |
| return 0 | |
| if __name__ == "__main__": | |
| sys.exit(main()) | |