SRK-CobuildX's picture
Release v0.1
02d8c71 verified
Raw History Blame Contribute Delete
857 Bytes
# Copyright 2026 Cobuild Tech Private Limited
# SPDX-License-Identifier: Apache-2.0
"""Run from the model folder: python example.py (every text below is invented for this example)"""
from cbx_emotion import EmotionClassifier
clf = EmotionClassifier(".")
texts = [
"Thank you so much, this made my whole week!",
"I can't believe they cancelled the show after one season. Ugh.",
"The meeting has been moved to 3 pm on Thursday.",
"Wait, you're telling me he actually won? Wow.",
"I miss my grandmother every single day.",
"That guy cut the whole queue and then yelled at the cashier. Disgusting behaviour.",
"I'm really nervous about my exam results tomorrow.",
]
for text, r in zip(texts, clf.classify(texts)):
tags = ', '.join(f"{l} {r['scores'][l]:.2f}" for l in r['labels']) or '(none)'
print(f"{tags:<28} {text}")