Spaces:
Sleeping
Sleeping
Commit
•
4b36557
1
Parent(s):
0725cd2
Update app.py (#1)
Browse files- Update app.py (81fc71c653b62df7ee1e6ed9e2582976fef29799)
Co-authored-by: Manas Chopra <[email protected]>
app.py
CHANGED
@@ -16,6 +16,10 @@ def classify_feedback(feedback_text):
|
|
16 |
top_labels = result["labels"][:2]
|
17 |
scores = result["scores"][:2]
|
18 |
|
|
|
|
|
|
|
|
|
19 |
# Generate HTML content for displaying the scores as meters/progress bars
|
20 |
html_content = ""
|
21 |
for i in range(len(top_labels)):
|
@@ -33,5 +37,5 @@ gr.Interface(
|
|
33 |
inputs=feedback_textbox,
|
34 |
outputs=feedback_output,
|
35 |
title="Feedback Classifier",
|
36 |
-
description="Enter your feedback and get the top 2 associated labels with scores."
|
37 |
).launch()
|
|
|
16 |
top_labels = result["labels"][:2]
|
17 |
scores = result["scores"][:2]
|
18 |
|
19 |
+
# Check if the accuracy of the top label is less than 30%
|
20 |
+
if scores[0] < 0.3:
|
21 |
+
return "Please provide another relevant feedback."
|
22 |
+
|
23 |
# Generate HTML content for displaying the scores as meters/progress bars
|
24 |
html_content = ""
|
25 |
for i in range(len(top_labels)):
|
|
|
37 |
inputs=feedback_textbox,
|
38 |
outputs=feedback_output,
|
39 |
title="Feedback Classifier",
|
40 |
+
description="Enter your feedback and get the top 2 associated labels with scores. If the accuracy of the top label is less than 30%, it will prompt for another relevant feedback."
|
41 |
).launch()
|