Spaces:
Runtime error
Runtime error
File size: 544 Bytes
22193d7 14e67e3 22193d7 e78c1cb 22193d7 e78c1cb 22193d7 e78c1cb 22193d7 e78c1cb 22193d7 a7e2438 1a767a0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
from transformers import pipeline
clf = pipeline(
task = 'sentiment-analysis',
model = 'SkolkovoInstitute/russian_toxicity_classifier')
text = ['У нас в есть убунты и текникал превью.',
'Как минимум два малолетних дегенерата в треде, мда.']
def data(text):
for row in text:
yield row
for out in clf(data(text)):
print(out)
#вывод
{'label': 'neutral', 'score': 0.9872767329216003}
{'label': 'toxic', 'score': 0.985331654548645}
|