Spaces:
Runtime error
Runtime error
File size: 513 Bytes
9db42cc |
1 2 3 4 5 6 7 8 9 10 11 12 |
from transformers import pipeline
from config import MODEL_NAME, INTENT_LABELS
# Load zero-shot classification pipeline
classifier = pipeline("zero-shot-classification", model=MODEL_NAME)
def classify_conversation(conversation_text):
result = classifier(conversation_text, INTENT_LABELS)
top_label = result['labels'][0]
rationale = f"Conversation was classified as '{top_label}' because the final messages indicate a likely intent of {top_label.lower()}."
return top_label, rationale
|