kairaamilanii
commited on
Commit
•
0959610
1
Parent(s):
51cb4c7
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,40 @@
|
|
1 |
-
---
|
2 |
-
license: cc0-1.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc0-1.0
|
3 |
+
datasets:
|
4 |
+
- kairaamilanii/cyberbullying-indonesia
|
5 |
+
language:
|
6 |
+
- id
|
7 |
+
metrics:
|
8 |
+
- accuracy
|
9 |
+
- confusion_matrix
|
10 |
+
base_model:
|
11 |
+
- indolem/indobertweet-base-uncased
|
12 |
+
pipeline_tag: text-classification
|
13 |
+
---
|
14 |
+
|
15 |
+
This model is based on a BERT model trained with a few bullying detection datasets. It is trained exclusively in the Indonesian language.
|
16 |
+
|
17 |
+
```python
|
18 |
+
from transformers import BertTokenizer, AutoModelForSequenceClassification
|
19 |
+
|
20 |
+
model_path = 'kairaamilanii/IndoBERT-Bullying-Classifier'
|
21 |
+
tokenizer = BertTokenizer.from_pretrained(model_path)
|
22 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
23 |
+
|
24 |
+
text = "KOK JELEK BANGET SIH" # Example text for prediction
|
25 |
+
|
26 |
+
inputs = tokenizer(text, return_tensors="pt")
|
27 |
+
with torch.no_grad():
|
28 |
+
outputs = model(**inputs)
|
29 |
+
predicted_class = torch.argmax(outputs.logits, dim=-1).item()
|
30 |
+
print(f"Predicted class: {predicted_class}")
|
31 |
+
|
32 |
+
if predicted_class == 1:
|
33 |
+
print("Prediction: Bullying")
|
34 |
+
else:
|
35 |
+
print("Prediction: Non-bullying")
|
36 |
+
```
|
37 |
+
example output:
|
38 |
+
```python
|
39 |
+
[{'Predicted class': 1, 'Prediction': Bullying}]
|
40 |
+
```
|