shayan5555's picture
Create app.py
b0f7721 verified
Raw History Blame Contribute Delete
790 Bytes
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")