const BATCH = 12; // scenes drawn at a time while scrolling const MODELS = { // column -> shown name, as the models are called in settings.py ideogram_4_reprompt: ["Ideogram 4", "ideogram-4-reprompt"], fibo_2_edit_turbo: ["FIBO 2 Edit Turbo", "fibo-2-edit-turbo"], flux_3_klein_reprompt: ["FLUX.3 klein", "flux-3-klein-reprompt"], hidream_o1_image_reprompt: ["HiDream-O1-Image", "hidream-o1-image-reprompt"], krea_2_turbo: ["Krea 2 Turbo", "krea-2-turbo"], ming_image_0_1_design: ["Ming-Image 0.1 Design", "ming-image-0.1-design"], moss_image_sft: ["MOSS-Image SFT", "moss-image-sft"], qwen_image_2_1_turbo_reprompt: ["Qwen-Image-2.1-Turbo", "qwen-image-2.1-turbo-reprompt"], qwen_image_2512_lightning: ["Qwen-Image-2512 Lightning", "qwen-image-2512-lightning"], }; const CATEGORIES = ["billiard", "checkers", "chess", "cupcake_candles", "fruitcake", "nuts", "shelf", "table"]; const UNSCORED = { chess: ["pawns"] }; // listed, not scored, as in 3_score.py let scenes = []; let order = Object.keys(MODELS); // best total first, once the scores are known let shown = []; let drawn = 0; let viewing = null; // [scene, model index] of the open picture const $ = (id) => document.getElementById(id); function readScene(row) { const scene = { ...row, expected: JSON.parse(row.expected), models: {} }; for (const model of Object.keys(MODELS)) { scene.models[model] = { picture: `pictures/${model}/${row.scene_id}.webp`, masks: `masks/${model}/${row.scene_id}.png`, found: JSON.parse(row[`${model}_found`]), points: row[`${model}_points`], rewrite: row[`${model}_rewrite`] ?? row.hidream_o1_image_reprompt_rewrite, ownRewrite: `${model}_rewrite` in row, }; } const ratios = Object.values(scene.models).map((result) => result.points / scene.possible_points); scene.mean = ratios.reduce((sum, ratio) => sum + ratio, 0) / ratios.length; scene.solved = ratios.some((ratio) => ratio === 1); scene.disagree = new Set(ratios).size > 1; return scene; } function kind(scene, check) { // as in scoring.py: "point", "extra", "flaw" (yes/no) or "listed" const expected = scene.expected[check]; if (expected === null || (UNSCORED[scene.category] ?? []).includes(check)) { return "listed"; } if (typeof expected === "boolean") { return "flaw"; } if (expected === 0) { return "extra"; } return "point"; } function verdict(scene, check, found) { // chip colour: "ok" +1, "wrong" no point or -1, "none" nothing to win or lose const expected = scene.expected[check]; const type = kind(scene, check); if (type === "point") { return found === expected ? "ok" : "wrong"; } if (type === "extra" || type === "flaw") { return found === expected ? "none" : "wrong"; } return "none"; } function value(number) { if (number === true) { return "✓"; } if (number === false) { return "✗"; } if (number === null || number === undefined) { return "?"; } return String(number); } function scoreTable() { const totals = {}; for (const model of Object.keys(MODELS)) { const perCategory = {}; for (const category of CATEGORIES) { const inCategory = scenes.filter((scene) => scene.category === category); const points = inCategory.reduce((sum, scene) => sum + scene.models[model].points, 0); const possible = inCategory.reduce((sum, scene) => sum + scene.possible_points, 0); perCategory[category] = points / possible; } const total = CATEGORIES.reduce((sum, category) => sum + perCategory[category], 0) / CATEGORIES.length; totals[model] = { total, ...perCategory }; } order = Object.keys(MODELS).sort((a, b) => totals[b].total - totals[a].total); const head = ["
No scene fits these filters.
'; drawn = 0; drawMore(); } function drawMore() { const next = shown.slice(drawn, drawn + BATCH); drawn += next.length; for (const scene of next) { $("scenes").append(sceneCard(scene)); } } function chips(scene, result) { const parts = []; for (const check of Object.keys(scene.expected)) { const found = result.found[check]; const type = kind(scene, check); const point = type === "point" ? " point" : ""; const title = `${check}: found ${value(found)}, expected ${value(scene.expected[check])}${type === "listed" ? " (not scored)" : ""}`; parts.push(`${value(found)}`); } return parts.join(""); } function sceneCard(scene) { const card = document.createElement("article"); card.className = "scene"; const expected = Object.entries(scene.expected).map(([check, number]) => `${MODELS[model][0]}: ${scene.models[model].rewrite}
`); card.innerHTML = `${scene.prompt}
The other 5 models drew HiDream-O1-Image's rewrite.
${result.points}/${scene.possible_points} points
| check | expected | found |
|---|
Drew ${whose}:
${result.rewrite}
← → other models · M masks · Esc close · hover an object for what SAM read
`; $("viewer").hidden = false; } function closeViewer() { $("viewer").hidden = true; viewing = null; } function keys(event) { if (!viewing) { return; } if (event.key === "Escape") { closeViewer(); } if (event.key === "ArrowRight") { openViewer(viewing[0], viewing[1] + 1); } if (event.key === "ArrowLeft") { openViewer(viewing[0], viewing[1] - 1); } if (event.key === "m" || event.key === "M") { $("masks").checked = !$("masks").checked; document.body.classList.toggle("masks", $("masks").checked); } } async function start() { try { const response = await fetch("scenes.json"); scenes = (await response.json()).map(readScene); } catch (error) { $("status").textContent = `Could not load the scenes (${error.message}).`; return; } scoreTable(); fillFilters(); update(); new IntersectionObserver((entries) => { if (entries[0].isIntersecting && drawn < shown.length) { drawMore(); } }, { rootMargin: "1200px" }).observe($("more")); $("close").addEventListener("click", closeViewer); $("previous").addEventListener("click", () => openViewer(viewing[0], viewing[1] - 1)); $("next").addEventListener("click", () => openViewer(viewing[0], viewing[1] + 1)); $("viewer").addEventListener("click", (event) => event.target === $("viewer") && closeViewer()); document.addEventListener("keydown", keys); } start();