Spaces:
Sleeping
Sleeping
Update tools/polite_guard.py
Browse files- tools/polite_guard.py +2 -1
tools/polite_guard.py
CHANGED
|
@@ -44,7 +44,8 @@ class PoliteGuardTool(Tool):
|
|
| 44 |
classifier = pipeline("text-classification", "Intel/polite-guard")
|
| 45 |
result = classifier(input_text)
|
| 46 |
print(f"return {str(result)}")
|
| 47 |
-
|
|
|
|
| 48 |
|
| 49 |
except Exception as e:
|
| 50 |
return f"Error fetching classification for text '{input_text}': {str(e)}"
|
|
|
|
| 44 |
classifier = pipeline("text-classification", "Intel/polite-guard")
|
| 45 |
result = classifier(input_text)
|
| 46 |
print(f"return {str(result)}")
|
| 47 |
+
output = result[0]
|
| 48 |
+
return output['label'], output['score']
|
| 49 |
|
| 50 |
except Exception as e:
|
| 51 |
return f"Error fetching classification for text '{input_text}': {str(e)}"
|