Spaces:
Sleeping
Sleeping
File size: 720 Bytes
6f0a968 2d139eb 6f0a968 35cac5d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import gradio as gr
from transformers import pipeline
classifier = pipeline("zero-shot-classification")
labels = ["No Connectivity", "Billing", "Setup", "Slow Connection"]
def predict(text):
preds = classifier(text, candidate_labels=labels)
return {label: float(pred) for label, pred in zip(preds["labels"], preds["scores"])}
input = gr.inputs.Textbox(label="Customer Sentence")
output = gr.outputs.Label(num_top_classes=4, label="Zero-Shot-Classification")
title = "Case Classification"
description = "Zero-Shot-Classification test"
gr.Interface(predict, input, output, live=False, live_update=False, title=title, analytics_enabled=False,
description=description, capture_session=True).launch() |