yetessam commited on
Commit
e67267c
·
verified ·
1 Parent(s): d8c7481

Update tools/polite_guard.py

Browse files
Files changed (1) hide show
  1. 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
- print(f"length is {len(result)}")
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)}"