Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,9 +15,14 @@ def predict(text):
|
|
15 |
for result in all_scores:
|
16 |
label = result['label']
|
17 |
score = result['score']
|
18 |
-
if label in ["Politeness"
|
19 |
-
# Highlight only the label
|
20 |
response += f"<span style='background-color:green; color:black;'>{label}</span>: {score:.3f}<br>"
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
else:
|
22 |
response += f"{label}: {score:.3f}<br>"
|
23 |
|
|
|
15 |
for result in all_scores:
|
16 |
label = result['label']
|
17 |
score = result['score']
|
18 |
+
if label in ["Politeness"]:
|
|
|
19 |
response += f"<span style='background-color:green; color:black;'>{label}</span>: {score:.3f}<br>"
|
20 |
+
if label in ["Sentiment"]:
|
21 |
+
response += f"<span style='background-color:yellow; color:black;'>{label}</span>: {score:.3f}<br>"
|
22 |
+
if label in ["Formality"]:
|
23 |
+
response += f"<span style='background-color:blue; color:black;'>{label}</span>: {score:.3f}<br>"
|
24 |
+
if label in ["Toxicity"]:
|
25 |
+
response += f"<span style='background-color:red; color:black;'>{label}</span>: {score:.3f}<br>"
|
26 |
else:
|
27 |
response += f"{label}: {score:.3f}<br>"
|
28 |
|