File size: 942 Bytes
047d5eb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from transformers import pipeline

# Load the model
model_name = "knowledgator/comprehend_it-base"
classifier = pipeline("zero-shot-classification", model=model_name, device="cpu")

# Function to classify feedback
def classify_feedback(feedback_text):
    # Classify feedback using the loaded model
    labels = ["High Priority ticket", "Low Priority ticket", "Medium Priority ticket"]

    result = classifier(feedback_text, labels, multi_label=True)

    # Get the top label associated with the feedback
    top_label = result["labels"][0]

    return top_label

# Create Gradio interface
feedback_textbox = gr.Textbox(label="Enter your feedback:")
feedback_output = gr.Label(label="Top Label:")

gr.Interface(
    fn=classify_feedback,
    inputs=feedback_textbox,
    outputs=feedback_output,
    title="Feedback Classifier",
    description="Enter your feedback and get the priority label for your ticket."
).launch()