Views
No views yet
| ID | 카테고리 | per-class F1 |
|---|---|---|
| 1 | 교통 | 0.882 |
| 2 | 건축 | 0.755 |
| 3 | 행정 | 0.812 |
| 4 | 보건위생 | 0.911 |
| 5 | 환경 | 0.874 |
| 6 | 문화_여가 | 0.825 |
| 7 | 농축산 | 0.909 |
| 8 | 복지 | 0.866 |
| 9 | 세무 | 0.974 |
| 10 | 상하수도 | 0.921 |
| 11 | 경제 | 0.874 |
#@주소# 등) → special token([ADDR] 등) 치환klue/bert-base1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4tokenizer = AutoTokenizer.from_pretrained("atti433/minde-classifier")
5model = AutoModelForSequenceClassification.from_pretrained("atti433/minde-classifier")
6
7text = "집 앞에 차가 자꾸 불법주차해서 너무 불편합니다."
8inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
9with torch.no_grad():
10 logits = model(**inputs).logits
11probs = torch.softmax(logits, dim=-1)
12labels = ['교통','건축','행정','보건위생','환경','문화_여가','농축산','복지','세무','상하수도','경제']
13pred = labels[probs.argmax().item()]
14print(pred, probs.max().item())chatbot_service.classify_complaint() 사용.