Spaces:
Sleeping
Sleeping
vickeee465
commited on
Commit
·
0b600d9
1
Parent(s):
31789f1
float (heatmap)
Browse files
app.py
CHANGED
@@ -78,7 +78,7 @@ def prepare_heatmap_data(data):
|
|
78 |
print("DEBUG: Data type received in prepare_heatmap_data:", type(data))
|
79 |
print("DEBUG: Data content:", data)
|
80 |
|
81 |
-
heatmap_data = pd.DataFrame(
|
82 |
|
83 |
for idx, row in enumerate(data):
|
84 |
print(f"DEBUG: Item at index {idx}: {row} (type: {type(row)})")
|
@@ -89,7 +89,7 @@ def prepare_heatmap_data(data):
|
|
89 |
confidences = row["emotions"].tolist()
|
90 |
for idy, confidence in enumerate(confidences):
|
91 |
emotion = id2label[idy]
|
92 |
-
heatmap_data.at[idx, emotion] =
|
93 |
|
94 |
heatmap_data.index = [item["sentence"][:18]+"..." for item in data]
|
95 |
return heatmap_data
|
|
|
78 |
print("DEBUG: Data type received in prepare_heatmap_data:", type(data))
|
79 |
print("DEBUG: Data content:", data)
|
80 |
|
81 |
+
heatmap_data = pd.DataFrame(0.0, index=range(len(data)), columns=id2label.values())
|
82 |
|
83 |
for idx, row in enumerate(data):
|
84 |
print(f"DEBUG: Item at index {idx}: {row} (type: {type(row)})")
|
|
|
89 |
confidences = row["emotions"].tolist()
|
90 |
for idy, confidence in enumerate(confidences):
|
91 |
emotion = id2label[idy]
|
92 |
+
heatmap_data.at[idx, emotion] = round(confidence, 4)
|
93 |
|
94 |
heatmap_data.index = [item["sentence"][:18]+"..." for item in data]
|
95 |
return heatmap_data
|