Updated README.md
Browse files
README.md
CHANGED
@@ -1,16 +1,63 @@
|
|
1 |
---
|
2 |
tags:
|
3 |
-
- autotrain
|
4 |
- text-classification
|
|
|
5 |
language:
|
6 |
- it
|
7 |
widget:
|
8 |
-
- text:
|
9 |
datasets:
|
10 |
- tradicio/autotrain-data-it-emotion-analysis
|
|
|
11 |
co2_eq_emissions:
|
12 |
emissions: 0.4489187526120041
|
|
|
|
|
|
|
|
|
|
|
13 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
# Model Trained Using AutoTrain
|
16 |
|
@@ -30,27 +77,4 @@ co2_eq_emissions:
|
|
30 |
- Weighted Precision: 0.828
|
31 |
- Macro Recall: 0.828
|
32 |
- Micro Recall: 0.828
|
33 |
-
- Weighted Recall: 0.828
|
34 |
-
|
35 |
-
|
36 |
-
## Usage
|
37 |
-
|
38 |
-
You can use cURL to access this model:
|
39 |
-
|
40 |
-
```
|
41 |
-
$ curl -X POST -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"inputs": "I love AutoTrain"}' https://api-inference.huggingface.co/models/tradicio/autotrain-it-emotion-analysis-43095109829
|
42 |
-
```
|
43 |
-
|
44 |
-
Or Python API:
|
45 |
-
|
46 |
-
```
|
47 |
-
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
48 |
-
|
49 |
-
model = AutoModelForSequenceClassification.from_pretrained("tradicio/autotrain-it-emotion-analysis-43095109829", use_auth_token=True)
|
50 |
-
|
51 |
-
tokenizer = AutoTokenizer.from_pretrained("tradicio/autotrain-it-emotion-analysis-43095109829", use_auth_token=True)
|
52 |
-
|
53 |
-
inputs = tokenizer("I love AutoTrain", return_tensors="pt")
|
54 |
-
|
55 |
-
outputs = model(**inputs)
|
56 |
-
```
|
|
|
1 |
---
|
2 |
tags:
|
|
|
3 |
- text-classification
|
4 |
+
- emotion-analysis
|
5 |
language:
|
6 |
- it
|
7 |
widget:
|
8 |
+
- text: I love AutoTrain 🤗
|
9 |
datasets:
|
10 |
- tradicio/autotrain-data-it-emotion-analysis
|
11 |
+
- dair-ai/emotion
|
12 |
co2_eq_emissions:
|
13 |
emissions: 0.4489187526120041
|
14 |
+
license: cc-by-sa-4.0
|
15 |
+
metrics:
|
16 |
+
- accuracy
|
17 |
+
- f1
|
18 |
+
pipeline_tag: text-classification
|
19 |
---
|
20 |
+
# IT-EMOTION-ANALYZER
|
21 |
+
|
22 |
+
This is a model for emotion analysis of italian sentences trained on a translated dataset by [Google Translator](https://pypi.org/project/deep-translator/). It maps sentences & paragraphs with 6 emotions which are:
|
23 |
+
|
24 |
+
- 0: sadness
|
25 |
+
- 1: joy
|
26 |
+
- 2: love
|
27 |
+
- 3: anger
|
28 |
+
- 4: fear
|
29 |
+
- 5: surprise
|
30 |
+
|
31 |
+
<!--- Describe your model here -->
|
32 |
+
|
33 |
+
## Usage (Sentence-Transformers)
|
34 |
+
|
35 |
+
Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
|
36 |
+
|
37 |
+
```
|
38 |
+
pip install -U sentence-transformers
|
39 |
+
```
|
40 |
+
|
41 |
+
Then you can use the model like this:
|
42 |
+
|
43 |
+
```python
|
44 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
45 |
+
from transformers import pipeline
|
46 |
+
|
47 |
+
sentences = ["Questa è una frase triste", "Questa è una frase felice", "Questa è una frase di stupore"]
|
48 |
+
|
49 |
+
tokenizer = AutoTokenizer.from_pretrained("aiknowyou/it-emotion-analyzer")
|
50 |
+
model = AutoModelForSequenceClassification.from_pretrained("aiknowyou/it-emotion-analyzer")
|
51 |
+
|
52 |
+
emotion_analysis = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
|
53 |
+
emotion_analysis(sentences)
|
54 |
+
```
|
55 |
+
Obtaining the following result:
|
56 |
+
```python
|
57 |
+
[{'label': '0', 'score': 0.9481984972953796},
|
58 |
+
{'label': '1', 'score': 0.9299975037574768},
|
59 |
+
{'label': '5', 'score': 0.9543816447257996}]
|
60 |
+
```
|
61 |
|
62 |
# Model Trained Using AutoTrain
|
63 |
|
|
|
77 |
- Weighted Precision: 0.828
|
78 |
- Macro Recall: 0.828
|
79 |
- Micro Recall: 0.828
|
80 |
+
- Weighted Recall: 0.828
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|