AsyncCoder-10 commited on
Commit
d5fca1f
·
verified ·
1 Parent(s): 72501de

Update app/main.py

Browse files
Files changed (1) hide show
  1. app/main.py +3 -1
app/main.py CHANGED
@@ -100,7 +100,9 @@ async def moderate_text(request: TextRequest):
100
  text = request.text
101
 
102
  profanity_result = profanity_filter.check_profanity(text)
103
- tox_result = toxicity_pipe(text)[0]
 
 
104
 
105
  is_toxic_by_model = (
106
  tox_result["label"].lower() in ["toxic", "label_1"] and tox_result["score"] > 0.5
 
100
  text = request.text
101
 
102
  profanity_result = profanity_filter.check_profanity(text)
103
+ # tox_result = toxicity_pipe(text)[0]
104
+ raw_result = toxicity_pipe(text)
105
+ tox_result = raw_result[0][0] if isinstance(raw_result[0], list) else raw_result[0]
106
 
107
  is_toxic_by_model = (
108
  tox_result["label"].lower() in ["toxic", "label_1"] and tox_result["score"] > 0.5