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