Update README.md
Browse files
README.md
CHANGED
|
@@ -8,4 +8,19 @@ pipeline_tag: text-classification
|
|
| 8 |
# BERT for hate speech classification
|
| 9 |
The model is based on BERT and used for classifying a text as **toxic** and **non-toxic**.
|
| 10 |
|
| 11 |
-
The model was fine-tuned on the HateXplain dataset found here: https://huggingface.co/datasets/hatexplain
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
# BERT for hate speech classification
|
| 9 |
The model is based on BERT and used for classifying a text as **toxic** and **non-toxic**.
|
| 10 |
|
| 11 |
+
The model was fine-tuned on the HateXplain dataset found here: https://huggingface.co/datasets/hatexplain
|
| 12 |
+
|
| 13 |
+
## How to use
|
| 14 |
+
|
| 15 |
+
```python
|
| 16 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
|
| 17 |
+
|
| 18 |
+
# Load model and tokenizer
|
| 19 |
+
tokenizer = AutoTokenizer.from_pretrained('tum-nlp/bert-hateXplain')
|
| 20 |
+
model = AutoModelForSequenceClassification.from_pretrained('tum-nlp/bert-hateXplain')
|
| 21 |
+
|
| 22 |
+
# Create the pipeline for classification
|
| 23 |
+
hate_classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
| 24 |
+
|
| 25 |
+
# Predict
|
| 26 |
+
hate_classifier("Girls like attention and they get desperate")
|