Swoodplays
commited on
Commit
•
6e2c902
1
Parent(s):
8a206a9
Update README.md
Browse files
README.md
CHANGED
@@ -33,7 +33,23 @@ This model is fine-tuned on the 'emotion' dataset to classify text into six emot
|
|
33 |
|
34 |
## Intended uses & limitations
|
35 |
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
## Training and evaluation data
|
39 |
|
|
|
33 |
|
34 |
## Intended uses & limitations
|
35 |
|
36 |
+
from transformers import pipeline
|
37 |
+
import pandas as pd
|
38 |
+
emt_clf = pipeline("text-classification", model="Swoodplays/emotion-classification")
|
39 |
+
|
40 |
+
text = "I saw a movie today and it was really good."
|
41 |
+
|
42 |
+
preds = emt_clf(text, return_all_scores=True)
|
43 |
+
labels = ['sadness', 'joy', 'love', 'anger', 'fear', 'surprise']
|
44 |
+
|
45 |
+
print(preds)
|
46 |
+
|
47 |
+
preds_df = pd.DataFrame(preds[0])
|
48 |
+
plt.bar(labels, 100 * preds_df["score"])
|
49 |
+
plt.title(f'"{text}"')
|
50 |
+
plt.xlabel("Classfied emotions")
|
51 |
+
plt.ylabel("Class probability (%)")
|
52 |
+
plt.show()
|
53 |
|
54 |
## Training and evaluation data
|
55 |
|