mlboydaisuke's picture
GLiClass-Edge v3.0 for LiteRT: S128 and S256 graphs (fp32 and fp16 weights), float16 token table, tokenizer, Python host, Android sample, conversion scripts, fixtures and card
88c9095 verified
Raw History Blame Contribute Delete
941 Bytes
"""The model card's Python example: one invented support ticket, single-label and multi-label.
Run from the repository root: python examples/run_example.py
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from gliclass_litert import GliclassLiteRT # noqa: E402
text = (
"The Zorvik X2 router from Tallowmere Networks keeps dropping the connection every evening "
"around 9 pm. I have restarted it and reset it to factory settings, but the status light "
"still blinks orange."
)
labels = ["connectivity problem", "hardware defect", "billing issue", "feature request",
"installation help"]
with GliclassLiteRT(Path(__file__).resolve().parents[1]) as classifier:
for mode in ("single-label", "multi-label"):
result = classifier.classify(text, labels, classification_type=mode)
print(mode, [(r["label"], round(r["score"], 3)) for r in result])