Spaces:
Sleeping
Sleeping
vickeee465
commited on
Commit
·
3838a79
1
Parent(s):
2d748e6
id2label
Browse files
app.py
CHANGED
|
@@ -74,10 +74,10 @@ def get_most_probable_label(probs):
|
|
| 74 |
return label, probability
|
| 75 |
|
| 76 |
def prepare_heatmap_data(data):
|
| 77 |
-
heatmap_data = pd.DataFrame(0, index=range(len(data)), columns=
|
| 78 |
for idx, item in enumerate(data):
|
| 79 |
for idy, confidence in enumerate(item["emotions"]):
|
| 80 |
-
emotion =
|
| 81 |
heatmap_data.at[idx, emotion] = confidence
|
| 82 |
heatmap_data.index = [item["sentence"] for item in data]
|
| 83 |
return heatmap_data
|
|
|
|
| 74 |
return label, probability
|
| 75 |
|
| 76 |
def prepare_heatmap_data(data):
|
| 77 |
+
heatmap_data = pd.DataFrame(0, index=range(len(data)), columns=id2label.values())
|
| 78 |
for idx, item in enumerate(data):
|
| 79 |
for idy, confidence in enumerate(item["emotions"]):
|
| 80 |
+
emotion = id2label[idy]
|
| 81 |
heatmap_data.at[idx, emotion] = confidence
|
| 82 |
heatmap_data.index = [item["sentence"] for item in data]
|
| 83 |
return heatmap_data
|