yetessam commited on
Commit
952ed51
·
verified ·
1 Parent(s): 6864e15

Update tools/polite_guard.py

Browse files
Files changed (1) hide show
  1. 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", "Intel/polite-guard")
 
 
 
 
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]