Spaces:
Running
Running
Update tools/polite_guard.py
Browse files- tools/polite_guard.py +3 -1
tools/polite_guard.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
|
3 |
# Define the PoliteGuard tool
|
@@ -9,7 +11,7 @@ class PoliteGuardTool(Tool):
|
|
9 |
output_type = "any"
|
10 |
|
11 |
def forward(self, input_text: Any) -> Any:
|
12 |
-
self.label, self.
|
13 |
|
14 |
|
15 |
def __init__(self, *args, **kwargs):
|
|
|
1 |
+
from typing import Any, Optional
|
2 |
+
from smolagents.tools import Tool
|
3 |
from transformers import pipeline
|
4 |
|
5 |
# Define the PoliteGuard tool
|
|
|
11 |
output_type = "any"
|
12 |
|
13 |
def forward(self, input_text: Any) -> Any:
|
14 |
+
self.label, self.score = self.ask_polite_guard(input_text)
|
15 |
|
16 |
|
17 |
def __init__(self, *args, **kwargs):
|