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