Views
No views yet
from transformers import pipeline, AutoModelForTokenClassification, AutoTokenizer, AutoModelForSequenceClassification
tokenizer= AutoTokenizer.from_pretrained("ennp/bert-turkish-text-classification-cased")
model= AutoModelForSequenceClassification.from_pretrained("ennp/bert-turkish-text-classification-cased")
nlp=pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
code_to_label={
'LABEL_0': 'INSULT ',
'LABEL_1': 'RACIST ',
'LABEL_2': 'SEXIST',
'LABEL_3': 'PROFANITY ',
'LABEL_4': 'OTHER' }
code_to_label[nlp("kıl herif gibi davranma")[0]['label']]