Download example.py from zeechimp/zee: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/zeechimp/zee/resolve/main/example.py
- Command line
-
hf download hf://zeechimp/zee/example.py
-
curl -L -o example.py https://huggingface.co/zeechimp/zee/resolve/main/example.py
1.17 kB
| """ | |
| example.py | |
| Minimal usage example for the word-level hypervector intent router. | |
| """ | |
| from hv_intent import load_v2, predict, predict_batch | |
| def main(): | |
| model = load_v2(".") | |
| print("Single predictions:") | |
| examples = [ | |
| "what is the weather today", | |
| "remind me to call mom", | |
| "calculate ten times three", | |
| "what time is it", | |
| "hello there", | |
| "will it rain tomorrow", | |
| "set an alarm for seven", | |
| "how hot is it", | |
| ] | |
| for phrase in examples: | |
| pred = predict(model, phrase) | |
| print(f" {phrase:<32} -> {pred}") | |
| print() | |
| print("Batch prediction:") | |
| phrases = [ | |
| "good morning", | |
| "what is two plus two", | |
| "when is the meeting", | |
| "is it cloudy outside", | |
| ] | |
| preds = predict_batch(model, phrases) | |
| for p, label in zip(phrases, preds): | |
| print(f" {p:<28} -> {label}") | |
| print() | |
| print("Confidence scores:") | |
| _, scores = predict(model, "what is the weather today", return_scores=True) | |
| for label, s in zip(model["intent_labels"], scores): | |
| print(f" {label:<10} {s:>8.2f}") | |
| if __name__ == "__main__": | |
| main() |