File size: 790 Bytes
b0f7721
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from transformers import pipeline

# Load Hugging Face zero-shot classification model
classifier = pipeline("zero-shot-classification",
                      model="facebook/bart-large-mnli")

# Labels for our AICT problem
labels = ["Complaint", "Request", "Query", "Feedback"]

print("AICT - Smart Customer Message Classifier")
print("------------------------------------------")
print("Type your message below:")
print("Type 'exit' to quit\n")

while True:
    text = input("You: ")

    if text.lower() == "exit":
        break

    # AI classification
    result = classifier(text, labels)

    # Get best prediction
    predicted_label = result["labels"][0]
    score = result["scores"][0]

    print(f"\nPredicted Category: {predicted_label}")
    print(f"Confidence: {score:.2f}\n")