Spaces:
Running
Running
ping98k
commited on
Commit
·
048e22e
1
Parent(s):
4656699
Refactor heatmap event handling to update x-axis labels for clarity and ensure heatmap is plotted after processing search group logic.
Browse files- heatmap_event.js +4 -2
heatmap_event.js
CHANGED
@@ -121,12 +121,12 @@ export async function handleHeatmapEvent() {
|
|
121 |
[1, ...order.slice(1).map(idx => idx === -1 ? 1 : cosine(refEmbed, groupEmbeddings[idx]))],
|
122 |
...order.slice(1).map(i => [cosine(refEmbed, groupEmbeddings[i]), ...order.slice(1).map(j => sim[i][j])])
|
123 |
];
|
124 |
-
xLabels = ["Search
|
125 |
} else {
|
126 |
simOrdered = order.map(i => order.map(j => sim[i][j]));
|
127 |
xLabels = order.map(i => (clusterNames && clusterNames[i]) ? clusterNames[i] : `Group ${i + 1}`);
|
128 |
}
|
129 |
-
|
130 |
|
131 |
// If search group is provided and sorting by line, reorder lines in each group by similarity to search lines
|
132 |
if (useSearchGroup && search_by_max_search_line && searchEmbeds.length > 0) {
|
@@ -160,5 +160,7 @@ export async function handleHeatmapEvent() {
|
|
160 |
const finalText = buildFinalText(order[0] === -1 ? order.slice(1) : order, sortedLines, clusterNames, n);
|
161 |
document.getElementById("input").value = finalText;
|
162 |
}
|
|
|
|
|
163 |
progressBarInner.style.width = "100%";
|
164 |
}
|
|
|
121 |
[1, ...order.slice(1).map(idx => idx === -1 ? 1 : cosine(refEmbed, groupEmbeddings[idx]))],
|
122 |
...order.slice(1).map(i => [cosine(refEmbed, groupEmbeddings[i]), ...order.slice(1).map(j => sim[i][j])])
|
123 |
];
|
124 |
+
xLabels = ["Search", ...order.slice(1).map(i => (clusterNames && clusterNames[i]) ? clusterNames[i] : `Group ${i + 1}`)];
|
125 |
} else {
|
126 |
simOrdered = order.map(i => order.map(j => sim[i][j]));
|
127 |
xLabels = order.map(i => (clusterNames && clusterNames[i]) ? clusterNames[i] : `Group ${i + 1}`);
|
128 |
}
|
129 |
+
|
130 |
|
131 |
// If search group is provided and sorting by line, reorder lines in each group by similarity to search lines
|
132 |
if (useSearchGroup && search_by_max_search_line && searchEmbeds.length > 0) {
|
|
|
160 |
const finalText = buildFinalText(order[0] === -1 ? order.slice(1) : order, sortedLines, clusterNames, n);
|
161 |
document.getElementById("input").value = finalText;
|
162 |
}
|
163 |
+
|
164 |
+
plotHeatmap(simOrdered, xLabels, xLabels);
|
165 |
progressBarInner.style.width = "100%";
|
166 |
}
|