Unify viewer metrics panel
This commit is contained in:
parent
f9082979f6
commit
30896a3171
4 changed files with 31 additions and 45 deletions
|
|
@ -428,9 +428,11 @@ function renderInference(): void {
|
|||
}
|
||||
|
||||
function renderMetrics(): void {
|
||||
metricsPanel.innerHTML = "";
|
||||
metricsPanel.querySelectorAll<HTMLElement>("[data-dynamic='true']").forEach((node) => {
|
||||
node.remove();
|
||||
});
|
||||
const frame = getSelectedFrame();
|
||||
const items: Array<[string, string]> = [["Stage", state.currentStage]];
|
||||
const items: Array<[string, string]> = [];
|
||||
if (frame) {
|
||||
items.push(["Loss", frame.loss === null ? "n/a" : formatNumber(frame.loss, 4)]);
|
||||
for (const [key, value] of Object.entries(frame.terms)) {
|
||||
|
|
@ -447,6 +449,7 @@ function renderMetrics(): void {
|
|||
for (const [label, value] of items) {
|
||||
const node = document.createElement("div");
|
||||
node.className = "metric-chip";
|
||||
node.dataset.dynamic = "true";
|
||||
node.innerHTML = `<strong>${label}</strong><span>${value}</span>`;
|
||||
metricsPanel.appendChild(node);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue