Views
No views yet
| INSULT | OTHER | PROFANITY | RACIST | SEXIST | |
|---|---|---|---|---|---|
| Precision | 0.901 | 0.924 | 0.978 | 1.000 | 0.980 |
| Recall | 0.920 | 0.980 | 0.900 | 0.980 | 1.000 |
| F1 Score | 0.910 | 0.9514 | 0.937 | 0.989 | 0.990 |
1pip install torch torchvision torchaudio
2pip install tf-keras
3pip install transformers
4pip install tensorflow1from transformers import AutoTokenizer, TFAutoModelForSequenceClassification, TextClassificationPipeline
2
3# Load the tokenizer and model
4model_name = "nanelimon/bert-base-turkish-offensive"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
7
8# Create the pipeline
9pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, return_all_scores=True, top_k=2)
10
11# Test the pipeline
12print(pipe('Bu bir denemedir hadi sende dene!'))
13[[{'label': 'OTHER', 'score': 1.000}, {'label': 'INSULT', 'score': 0.000}]]