Update README.md
Browse files
README.md
CHANGED
@@ -24,22 +24,22 @@ To use the emo-Classification model, you can utilize the Hugging Face Transforme
|
|
24 |
from transformers import pipeline
|
25 |
|
26 |
# Initialize the classifier
|
27 |
-
classifier = pipeline(task="text-classification", model="
|
28 |
|
29 |
-
# Define the sentence to analyze
|
30 |
sentences = ["I am not having a great day"]
|
31 |
|
32 |
# Get the model output
|
33 |
model_outputs = classifier(sentences)
|
34 |
|
35 |
# Print the top emotion (first one in the list)
|
36 |
-
print(f"
|
37 |
```
|
38 |
|
39 |
### Example Input and Output
|
40 |
|
41 |
- **Input**: `"I am not having a great day"`
|
42 |
-
- **Output**: `
|
43 |
|
44 |
## Installation
|
45 |
|
|
|
24 |
from transformers import pipeline
|
25 |
|
26 |
# Initialize the classifier
|
27 |
+
classifier = pipeline(task="text-classification", model="AI4free/emo-Classification", top_k=1)
|
28 |
|
29 |
+
# Define the sentence to analyze# Define the sentence to analyze
|
30 |
sentences = ["I am not having a great day"]
|
31 |
|
32 |
# Get the model output
|
33 |
model_outputs = classifier(sentences)
|
34 |
|
35 |
# Print the top emotion (first one in the list)
|
36 |
+
print(f"emotion: {model_outputs[0][0]['label']} (Score: {model_outputs[0][0]['score']:.4f})")
|
37 |
```
|
38 |
|
39 |
### Example Input and Output
|
40 |
|
41 |
- **Input**: `"I am not having a great day"`
|
42 |
+
- **Output**: `emotion: <emotion_label> (Score: <score>)`
|
43 |
|
44 |
## Installation
|
45 |
|