Text Classification
Transformers
Safetensors
Thai
xlm-roberta
thai
toxicity-detection
hate-speech
nlp
text-embeddings-inference
Instructions to use mashironotdev/thai-toxic-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mashironotdev/thai-toxic-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="mashironotdev/thai-toxic-classifier")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("mashironotdev/thai-toxic-classifier") model = AutoModelForSequenceClassification.from_pretrained("mashironotdev/thai-toxic-classifier") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -105,4 +105,34 @@ Typical preprocessing steps:
|
|
| 105 |
|
| 106 |
## Training Configuration
|
| 107 |
|
| 108 |
-
Example configuration:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
## Training Configuration
|
| 107 |
|
| 108 |
+
Example configuration:
|
| 109 |
+
|
| 110 |
+
## Quick Usage
|
| 111 |
+
|
| 112 |
+
```python
|
| 113 |
+
# install dependencies
|
| 114 |
+
# pip install transformers torch
|
| 115 |
+
|
| 116 |
+
from transformers import pipeline
|
| 117 |
+
|
| 118 |
+
# load model from Hugging Face
|
| 119 |
+
classifier = pipeline(
|
| 120 |
+
"text-classification",
|
| 121 |
+
model="mashironotdev/thai-toxic-classifier"
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
# example inputs
|
| 125 |
+
texts = [
|
| 126 |
+
"สวัสดีครับ",
|
| 127 |
+
"ขอบคุณมากครับ",
|
| 128 |
+
"มึงโง่หรือไง",
|
| 129 |
+
"ไอ้ควาย"
|
| 130 |
+
]
|
| 131 |
+
|
| 132 |
+
# run inference
|
| 133 |
+
results = classifier(texts)
|
| 134 |
+
|
| 135 |
+
# print results
|
| 136 |
+
for text, result in zip(texts, results):
|
| 137 |
+
print(text, "->", result)
|
| 138 |
+
```
|