Views
No views yet
| Label | Emotion | English |
|---|---|---|
| 0 | 기쁨 | Joy |
| 1 | 슬픔 | Sadness |
| 2 | 분노 | Anger |
| 3 | 불안 | Anxiety |
| 4 | 당황 | Embarrassment |
| 5 | 상처 | Hurt |
| Metric | Score |
|---|---|
| Accuracy | 98.49% |
| F1 Score (weighted) | 98.49% |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_name = "jeongyoonhuh/kobert-emotion-6class"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForSequenceClassification.from_pretrained(model_name)
7
8text = "오늘 정말 기분이 좋아요!"
9inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256)
10
11with torch.no_grad():
12 outputs = model(**inputs)
13 prediction = torch.argmax(outputs.logits, dim=1).item()
14
15emotions = ['기쁨', '슬픔', '분노', '불안', '당황', '상처']
16print(f"Predicted emotion: {emotions[prediction]}")