Spaces:
Sleeping
Sleeping
Luciferalive
commited on
Commit
•
d775997
1
Parent(s):
81422e6
Update app.py
Browse files
app.py
CHANGED
@@ -12,14 +12,14 @@ def classify_feedback(feedback_text):
|
|
12 |
result = classifier(feedback_text, labels, multi_label=True)
|
13 |
|
14 |
# Get the top two labels associated with the feedback
|
15 |
-
top_labels =
|
16 |
-
scores =
|
17 |
|
18 |
return {top_labels[i]: scores[i] for i in range(len(top_labels))}
|
19 |
|
20 |
# Create Gradio interface
|
21 |
-
feedback_textbox = gr.
|
22 |
-
feedback_output = gr.
|
23 |
|
24 |
gr.Interface(
|
25 |
fn=classify_feedback,
|
|
|
12 |
result = classifier(feedback_text, labels, multi_label=True)
|
13 |
|
14 |
# Get the top two labels associated with the feedback
|
15 |
+
top_labels = result["labels"][:2]
|
16 |
+
scores = result["scores"][:2]
|
17 |
|
18 |
return {top_labels[i]: scores[i] for i in range(len(top_labels))}
|
19 |
|
20 |
# Create Gradio interface
|
21 |
+
feedback_textbox = gr.Textbox(label="Enter your feedback:")
|
22 |
+
feedback_output = gr.Textbox(label="Top 2 Labels with Scores:")
|
23 |
|
24 |
gr.Interface(
|
25 |
fn=classify_feedback,
|