hplisiecki
commited on
Commit
•
f214bbb
1
Parent(s):
99c1831
Update README.md
Browse files
README.md
CHANGED
@@ -60,6 +60,7 @@ You can use the model and tokenizer as follows:
|
|
60 |
|
61 |
```python
|
62 |
from transformers import AutoTokenizer, AutoModel
|
|
|
63 |
|
64 |
# Load the tokenizer
|
65 |
tokenizer = AutoTokenizer.from_pretrained("hplisiecki/polemo-intensity")
|
@@ -67,7 +68,13 @@ tokenizer = AutoTokenizer.from_pretrained("hplisiecki/polemo-intensity")
|
|
67 |
# Load the model
|
68 |
model = AutoModel.from_pretrained("hplisiecki/polemo-intensity")
|
69 |
|
|
|
|
|
|
|
70 |
# Test the model with a sample input
|
71 |
inputs = tokenizer("This is a test input.", return_tensors="pt")
|
72 |
outputs = model(**inputs)
|
73 |
-
|
|
|
|
|
|
|
|
60 |
|
61 |
```python
|
62 |
from transformers import AutoTokenizer, AutoModel
|
63 |
+
import torch
|
64 |
|
65 |
# Load the tokenizer
|
66 |
tokenizer = AutoTokenizer.from_pretrained("hplisiecki/polemo-intensity")
|
|
|
68 |
# Load the model
|
69 |
model = AutoModel.from_pretrained("hplisiecki/polemo-intensity")
|
70 |
|
71 |
+
# Define emotion columns
|
72 |
+
emotion_columns = ['Happiness', 'Sadness', 'Anger', 'Disgust', 'Fear', 'Pride', 'Valence', 'Arousal']
|
73 |
+
|
74 |
# Test the model with a sample input
|
75 |
inputs = tokenizer("This is a test input.", return_tensors="pt")
|
76 |
outputs = model(**inputs)
|
77 |
+
|
78 |
+
# Print out the emotion ratings
|
79 |
+
for emotion, rating in zip(emotion_columns, outputs):
|
80 |
+
print(f"{emotion}: {rating.item()}")
|