Spaces:
Sleeping
Sleeping
Update tools/polite_guard.py
Browse files- tools/polite_guard.py +5 -1
tools/polite_guard.py
CHANGED
|
@@ -42,7 +42,11 @@ class PoliteGuardTool(Tool):
|
|
| 42 |
tuple: with classification label and the score
|
| 43 |
"""
|
| 44 |
try:
|
| 45 |
-
classifier = pipeline("text-classification",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
result = classifier(input_text)
|
| 47 |
print(f"return {str(result)}")
|
| 48 |
output = result[0]
|
|
|
|
| 42 |
tuple: with classification label and the score
|
| 43 |
"""
|
| 44 |
try:
|
| 45 |
+
classifier = pipeline("text-classification",
|
| 46 |
+
"Intel/polite-guard",
|
| 47 |
+
return_all_scores=True, # <-- get all four probabilities in one call
|
| 48 |
+
truncation=True
|
| 49 |
+
)
|
| 50 |
result = classifier(input_text)
|
| 51 |
print(f"return {str(result)}")
|
| 52 |
output = result[0]
|