Update README.md
Browse files
README.md
CHANGED
@@ -70,7 +70,7 @@ def predict(path, sampling_rate):
|
|
70 |
logits = model(**inputs).logits
|
71 |
|
72 |
scores = F.softmax(logits, dim=1).detach().cpu().numpy()[0]
|
73 |
-
outputs = [{"
|
74 |
return outputs
|
75 |
```
|
76 |
|
@@ -86,7 +86,7 @@ outputs = predict(path, sampling_rate)
|
|
86 |
{'Label': 'Happiness', 'Score': '0.0%'},
|
87 |
{'Label': 'Neutral', 'Score': '0.0%'},
|
88 |
{'Label': 'Sadness', 'Score': '99.9%'},
|
89 |
-
{'Label': 'Surprise', 'Score': '0.0%'}
|
90 |
]
|
91 |
```
|
92 |
|
|
|
70 |
logits = model(**inputs).logits
|
71 |
|
72 |
scores = F.softmax(logits, dim=1).detach().cpu().numpy()[0]
|
73 |
+
outputs = [{"Label": config.id2label[i], "Score": f"{round(score * 100, 3):.1f}%"} for i, score in enumerate(scores)]
|
74 |
return outputs
|
75 |
```
|
76 |
|
|
|
86 |
{'Label': 'Happiness', 'Score': '0.0%'},
|
87 |
{'Label': 'Neutral', 'Score': '0.0%'},
|
88 |
{'Label': 'Sadness', 'Score': '99.9%'},
|
89 |
+
{'Label': 'Surprise', 'Score': '0.0%'}
|
90 |
]
|
91 |
```
|
92 |
|