yoon-eunbin commited on
Commit
c1fc28b
·
verified ·
1 Parent(s): 9ebfac2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +30 -13
README.md CHANGED
@@ -1,19 +1,36 @@
 
1
  ---
 
 
 
 
 
2
  datasets:
3
  - AiLab-IMCS-UL/twitter_emotions-en
4
- language:
5
- - en
6
- base_model:
7
- - distilbert/distilbert-base-uncased
8
- pipeline_tag: text-classification
9
 
10
- id2label:
11
- '0': 'sadness'
12
- '1': 'joy'
13
- '2': 'love'
14
- '3': 'anger'
15
- '4': 'fear'
16
- '5': 'surprise'
17
 
18
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
 
 
 
 
1
+ %%writefile README.md
2
  ---
3
+ language: en
4
+ tags:
5
+ - text-classification
6
+ - emotions
7
+ - sentiment-analysis
8
  datasets:
9
  - AiLab-IMCS-UL/twitter_emotions-en
10
+ widget:
11
+ - text: "I'm so happy today!"
12
+ - text: "I feel really sad and lonely."
13
+ - text: "This makes me so angry!"
14
+ ---
15
 
16
+ # Emotion Classification Model
 
 
 
 
 
 
17
 
18
+ This model classifies text into 6 emotions: sadness, joy, love, anger, fear, surprise.
19
+
20
+ ## Usage
21
+ ```python
22
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
23
+ import torch
24
+
25
+ tokenizer = AutoTokenizer.from_pretrained("your-username/emotion-classifier")
26
+ model = AutoModelForSequenceClassification.from_pretrained("your-username/emotion-classifier")
27
+
28
+ text = "I'm so happy!"
29
+ inputs = tokenizer(text, return_tensors="pt")
30
+ outputs = model(**inputs)
31
+ predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
32
+ predicted_class = torch.argmax(predictions).item()
33
 
34
+ emotions = ['sadness', 'joy', 'love', 'anger', 'fear', 'surprise']
35
+ print(f"Emotion: {emotions[predicted_class]}")
36
+ ```