Update README.md
Browse files
README.md
CHANGED
|
@@ -76,8 +76,18 @@ It is **not** intended for clinical diagnosis or professional mental health deci
|
|
| 76 |
from transformers import pipeline
|
| 77 |
|
| 78 |
classifier = pipeline(
|
| 79 |
-
"text-classification",
|
| 80 |
-
model="
|
|
|
|
| 81 |
)
|
| 82 |
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
from transformers import pipeline
|
| 77 |
|
| 78 |
classifier = pipeline(
|
| 79 |
+
task="text-classification",
|
| 80 |
+
model="your-username/deberta-emotion-multilabel",
|
| 81 |
+
return_all_scores=True
|
| 82 |
)
|
| 83 |
|
| 84 |
+
text = "I feel scared but also strangely hopeful about the future."
|
| 85 |
+
|
| 86 |
+
outputs = classifier(text)
|
| 87 |
+
|
| 88 |
+
THRESHOLD = "According to your preferences"
|
| 89 |
+
predicted_emotions = [
|
| 90 |
+
o["label"] for o in outputs[0] if o["score"] >= THRESHOLD
|
| 91 |
+
]
|
| 92 |
+
|
| 93 |
+
print(predicted_emotions)
|