import gradio as gr from transformers import pipeline clf = pipeline("text-classification", model="preshanth09/support-ticket-classifier", top_k=None) EXAMPLES = [ "I was charged twice for my subscription this month and need a refund.", "Our dashboard has been down for all users since 9 AM. Is there an outage?", "The item I received is damaged. How do I return it for a replacement?", "Can you send pricing for 50 licenses and set up a demo call next week?", ] def classify(text): if not text.strip(): return {} scores = clf(text, truncation=True, max_length=256) scores = scores[0] if scores and isinstance(scores[0], list) else scores return {s["label"]: float(s["score"]) for s in scores} gr.Interface( fn=classify, inputs=gr.Textbox(lines=6, label="Support ticket (subject and body)"), outputs=gr.Label(num_top_classes=5, label="Predicted queue"), examples=EXAMPLES, title="Support Ticket Routing Classifier", description="Fine-tuned BERT that routes English support tickets to one of 10 queues " "(test macro-F1 0.579 vs 0.507 for a TF-IDF baseline). Trained on a synthetic " "public dataset; see the model card for limitations.", ).launch()