Spaces:
Runtime error
Runtime error
File size: 456 Bytes
e2eccc0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from detoxify import Detoxify
#https://github.com/unitaryai/detoxify/
toxicModel = Detoxify('original')
def predictThreat(text):
res = toxicModel.predict(text)
# print(res)
threatList=[]
for key in res:
if(res[key]>0.5):
threatList.append(key)
if(len(threatList)!=0):
return("threat")
else:
return("safe")
if __name__ == "__main__":
print(predictThreat("I dont wish to live anymore")) |