Luciferalive commited on
Commit
047d5eb
1 Parent(s): ad8e03f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the model
5
+ model_name = "knowledgator/comprehend_it-base"
6
+ classifier = pipeline("zero-shot-classification", model=model_name, device="cpu")
7
+
8
+ # Function to classify feedback
9
+ def classify_feedback(feedback_text):
10
+ # Classify feedback using the loaded model
11
+ labels = ["High Priority ticket", "Low Priority ticket", "Medium Priority ticket"]
12
+
13
+ result = classifier(feedback_text, labels, multi_label=True)
14
+
15
+ # Get the top label associated with the feedback
16
+ top_label = result["labels"][0]
17
+
18
+ return top_label
19
+
20
+ # Create Gradio interface
21
+ feedback_textbox = gr.Textbox(label="Enter your feedback:")
22
+ feedback_output = gr.Label(label="Top Label:")
23
+
24
+ gr.Interface(
25
+ fn=classify_feedback,
26
+ inputs=feedback_textbox,
27
+ outputs=feedback_output,
28
+ title="Feedback Classifier",
29
+ description="Enter your feedback and get the priority label for your ticket."
30
+ ).launch()