Spaces:
Sleeping
Sleeping
Update tools/polite_guard.py
Browse files- tools/polite_guard.py +4 -3
tools/polite_guard.py
CHANGED
|
@@ -30,15 +30,16 @@ class PoliteGuardTool(Tool):
|
|
| 30 |
input_text: The text to classify.
|
| 31 |
|
| 32 |
Returns:
|
| 33 |
-
|
| 34 |
a. A in result['label'] which is one of the four classifications
|
| 35 |
b. A score in result['score']
|
| 36 |
"""
|
| 37 |
try:
|
| 38 |
classifier = pipeline("text-classification", "Intel/polite-guard")
|
|
|
|
| 39 |
return {
|
| 40 |
-
"label":
|
| 41 |
-
"score":
|
| 42 |
}
|
| 43 |
|
| 44 |
except Exception as e:
|
|
|
|
| 30 |
input_text: The text to classify.
|
| 31 |
|
| 32 |
Returns:
|
| 33 |
+
string with
|
| 34 |
a. A in result['label'] which is one of the four classifications
|
| 35 |
b. A score in result['score']
|
| 36 |
"""
|
| 37 |
try:
|
| 38 |
classifier = pipeline("text-classification", "Intel/polite-guard")
|
| 39 |
+
|
| 40 |
return {
|
| 41 |
+
"label": classifier['label'],
|
| 42 |
+
"score": classifier['score']
|
| 43 |
}
|
| 44 |
|
| 45 |
except Exception as e:
|