Spaces:
Sleeping
Sleeping
Update tools/polite_guard.py
Browse files- tools/polite_guard.py +2 -3
tools/polite_guard.py
CHANGED
|
@@ -30,12 +30,11 @@ class PoliteGuardTool(Tool):
|
|
| 30 |
input_text: The text to classify.
|
| 31 |
|
| 32 |
Returns:
|
| 33 |
-
|
| 34 |
"""
|
| 35 |
try:
|
| 36 |
classifier = pipeline("text-classification", "Intel/polite-guard")
|
| 37 |
-
|
| 38 |
-
return classifier['label']
|
| 39 |
|
| 40 |
except Exception as e:
|
| 41 |
return f"Error fetching classification for text '{input_text}': {str(e)}"
|
|
|
|
| 30 |
input_text: The text to classify.
|
| 31 |
|
| 32 |
Returns:
|
| 33 |
+
string with classification label
|
| 34 |
"""
|
| 35 |
try:
|
| 36 |
classifier = pipeline("text-classification", "Intel/polite-guard")
|
| 37 |
+
return classifier(input_text)
|
|
|
|
| 38 |
|
| 39 |
except Exception as e:
|
| 40 |
return f"Error fetching classification for text '{input_text}': {str(e)}"
|