val-video-boost / app.js
Jouly's picture
Commercial product page: editions, licensing, mechanism
2554456 verified
Raw History Blame Contribute Delete
10.4 kB
(async function () {
const EV = await (await fetch("evidence/video_evidence.json")).json();
const TAU = EV.tau, LC = EV.long_chain_24, X48 = EV.chain_48_extra, REF = EV.reference_plugin_24, CS = EV.cross_scene_6, CW = EV.cross_window_video;
const CHAIN = LC.rows.concat(X48.rows);
const REFS = {}; REF.rows.forEach(r => REFS[r.segment] = r.score);
const f3 = x => (Math.round(Number(x) * 1000 + 1e-6) / 1000).toFixed(3), f4 = x => Number(x).toFixed(4);
const $ = id => document.getElementById(id);
const css = n => getComputedStyle(document.documentElement).getPropertyValue(n).trim();
const BLUE = "var(--blue)", TEAL = "var(--teal)", GREEN = "var(--green)", REFC = "var(--ref)", GRAY = "#94a3b8";
const s = LC.summary;
const C48 = LC.rows.concat(X48.rows).map(r => r.chosen_score), m48 = C48.reduce((a, b) => a + b, 0) / C48.length;
$("heroStats").innerHTML = [[`${C48.filter(v => v >= TAU).length}/${C48.length}`, "segments above the same-person bar", "g"], [f3(m48), "mean identity over 48 segments", "b"],
[`${f3(X48.summary.quarter_means[0])} → ${f3(X48.summary.quarter_means[3])}`, "first vs last quarter of the chain: no decay", "t"], ["0", "abstentions · plugin route averages 0.552", "b"]]
.map(([n, l, c]) => `<div class="card stat"><div class="n ${c}">${n}</div><div class="l">${l}</div></div>`).join("");
// concept diagram
$("diagram").innerHTML = `<svg viewBox="0 0 960 200" role="img" aria-label="Character Bible to any generator to Fate gate">
<defs><marker id="ar" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto"><path d="M0,0 L10,5 L0,10 z" fill="${GRAY}"/></marker></defs>
<g font-size="15">
<rect x="10" y="40" width="210" height="110" rx="14" fill="rgba(0,102,255,.10)" stroke="${BLUE}"/>
<text x="115" y="80" text-anchor="middle" font-weight="700">Character Bible</text><text x="115" y="104" text-anchor="middle" font-size="13" class="mut">outside the model</text><text x="115" y="124" text-anchor="middle" font-size="13" class="mut">verbatim · fingerprinted</text>
<line x1="222" y1="95" x2="282" y2="95" stroke="${GRAY}" stroke-width="2" marker-end="url(#ar)"/>
<rect x="286" y="40" width="210" height="110" rx="14" fill="rgba(148,163,184,.12)" stroke="${GRAY}"/>
<text x="391" y="80" text-anchor="middle" font-weight="700">Any generator</text><text x="391" y="104" text-anchor="middle" font-size="13" class="mut">image or video</text><text x="391" y="124" text-anchor="middle" font-size="13" class="mut">K candidates / segment</text>
<line x1="498" y1="95" x2="558" y2="95" stroke="${GRAY}" stroke-width="2" marker-end="url(#ar)"/>
<rect x="562" y="40" width="210" height="110" rx="14" fill="rgba(0,169,154,.12)" stroke="${TEAL}"/>
<text x="667" y="80" text-anchor="middle" font-weight="700">Fate select + verify</text><text x="667" y="104" text-anchor="middle" font-size="13" class="mut">closest to the anchor</text><text x="667" y="124" text-anchor="middle" font-size="13" class="mut">τ = 0.5 gate · all scores logged</text>
<line x1="774" y1="80" x2="820" y2="52" stroke="${GRAY}" stroke-width="2" marker-end="url(#ar)"/><line x1="774" y1="110" x2="820" y2="140" stroke="${GRAY}" stroke-width="2" marker-end="url(#ar)"/>
<rect x="824" y="22" width="128" height="52" rx="12" fill="rgba(0,200,83,.12)" stroke="${GREEN}"/><text x="888" y="53" text-anchor="middle" font-weight="700">Accepted</text>
<rect x="824" y="116" width="128" height="52" rx="12" fill="rgba(229,72,77,.10)" stroke="#e5484d"/><text x="888" y="140" text-anchor="middle" font-weight="700">Abstain</text><text x="888" y="158" text-anchor="middle" font-size="12" class="mut">regenerate</text>
</g></svg>`;
const H = window.RIcharts.hbar;
H($("cmpChart"), [
{ label: "Fate layer · 6 cross-scene", value: CS.summary.chosen_mean, color: BLUE },
{ label: "Fate layer · 24-seg chain", value: s.mean, color: BLUE },
{ label: "Plugin · 6 cross-scene", value: CS.summary.reference_plugin_mean, color: REFC },
{ label: "Plugin · 24-seg chain", value: REF.summary.mean, color: REFC },
{ label: "Plain short prompt", value: 0.471, color: GRAY },
{ label: "A different person", value: CS.summary.different_person, color: GRAY, muted: true }],
{ max: 0.8, tau: TAU, tauLabel: "τ 0.5", labelW: 210, w: 560 });
H($("quarterChart"), X48.summary.quarter_means.map((v, i) => ({ label: `Segments ${i * 12}–${i * 12 + 11}`, value: v, color: [BLUE, TEAL, GREEN, BLUE][i] })),
{ max: 0.8, tau: TAU, tauLabel: "τ 0.5", labelW: 150, w: 560 });
H($("supplyChart"), [
{ label: "Short fragment", value: 0.471, color: GRAY },
{ label: "Short + negatives", value: 0.419, color: GRAY },
{ label: "Detailed, reworded", value: 0.506, color: REFC },
{ label: "Detailed block", value: 0.589, color: TEAL },
{ label: "Detailed + \"never\" facts", value: 0.610, color: BLUE }],
{ max: 0.8, tau: TAU, tauLabel: "τ 0.5", labelW: 190, w: 560 });
H($("sizeChart"), [
{ label: "Generator A", value: 0.471, color: TEAL },
{ label: "Generator B (several× params)", value: 0.480, color: BLUE }],
{ max: 0.8, tau: TAU, tauLabel: "τ 0.5", labelW: 230, w: 560, rowH: 46 });
H($("videoChart"), [
{ label: "Within one take (short)", value: 0.90, color: GREEN, text: "0.90" },
{ label: "Within one take (longest)", value: 0.96, color: GREEN, text: "0.96+" },
{ label: "Next window · anchor-frame start", value: CW.anchor_frame_selected, color: BLUE },
{ label: "Next window · text only (best)", value: Math.max(...CW.text_only_takes), color: GRAY },
{ label: "Next window · text only (worst)", value: Math.min(...CW.text_only_takes), color: GRAY }],
{ max: 1, tau: TAU, tauLabel: "τ 0.5", labelW: 240, w: 560 });
const EXP = [
["24-segment chain", "12 hostile scenes × 2 seeds, 4 candidates each, same pass bar as the plugin test", `${f3(s.mean)} mean · ${f3(s.min)} min · 24/24`, "Beats the plugin route (0.552) with no reference image fed in"],
["48-segment pressure chain", "24 more segments on new seeds, same character", `${X48.summary.quarter_means.map(f3).join(" / ")}`, "No decay with length"],
["Cross-scene, 6 segments", "3 seeds × 2 scenes, enrolled studio anchor", `${f3(CS.summary.chosen_mean)} · min ${f3(CS.summary.chosen_min)} · 6/6`, "Plugin scored 0.581 on the same set"],
["Supply factorial", "short / detailed × with / without negatives, same scenes", "0.471 → 0.610", "Pinned detailed text is the main lever"],
["Model size", "same short prompt on a model with several× the parameters", "0.471 vs 0.480", "Size buys render quality, not identity"],
["Cross-window video", "second window from text only vs from the anchor frame", `${f3(Math.max(...CW.text_only_takes))} vs ${f3(CW.anchor_frame_selected)}`, "Pixel anchoring is required across windows"],
["Foreign real face", "target a face that isn't in the bible's character", "0.372 · abstained", "The gate refuses instead of passing a lookalike"]];
$("expTable").innerHTML = EXP.map(r => `<tr><td><b>${r[0]}</b></td><td class="mut small">${r[1]}</td><td class="num"><b>${r[2]}</b></td><td class="small">${r[3]}</td></tr>`).join("");
// 48-seg line chart
const W = 960, Hh = 330, L = 48, R = 16, T = 14, B = 36, y0 = 0.3, y1 = 0.8, n = CHAIN.length;
const X = i => L + (W - L - R) * i / (n - 1), Y = v => T + (Hh - T - B) * (1 - (v - y0) / (y1 - y0));
let g = "";
for (let v = 0.3; v <= 0.801; v += 0.1) g += `<line x1="${L}" x2="${W - R}" y1="${Y(v)}" y2="${Y(v)}" stroke="currentColor" opacity=".12"/><text x="${L - 8}" y="${Y(v) + 4}" font-size="12" text-anchor="end" class="mut">${v.toFixed(1)}</text>`;
for (let i = 0; i < n; i += 6) g += `<text x="${X(i)}" y="${Hh - 12}" font-size="12" text-anchor="middle" class="mut">${CHAIN[i].segment}</text>`;
g += `<line x1="${L}" x2="${W - R}" y1="${Y(TAU)}" y2="${Y(TAU)}" stroke="#e5484d" stroke-width="2" stroke-dasharray="6 5"/>`;
const path = pts => pts.map((p, k) => (k ? "L" : "M") + p[0].toFixed(1) + " " + p[1].toFixed(1)).join(" ");
const refPts = CHAIN.map((r, i) => r.segment in REFS ? [X(i), Y(REFS[r.segment])] : null).filter(Boolean);
g += `<path d="${path(refPts)}" fill="none" stroke="${REFC}" stroke-width="2.5"/>`;
g += `<path d="${path(CHAIN.map((r, i) => [X(i), Y(r.chosen_score)]))}" fill="none" stroke="${BLUE}" stroke-width="3"/>`;
CHAIN.forEach((r, i) => g += `<circle data-i="${i}" cx="${X(i)}" cy="${Y(r.chosen_score)}" r="5" fill="${r.abstained ? "#e5484d" : BLUE}" style="cursor:pointer"><title>Segment ${r.segment} · ${r.scene}: ${f4(r.chosen_score)}</title></circle>`);
g += `<circle id="hl" r="9" fill="none" stroke="currentColor" stroke-width="2"/>`;
$("chart").innerHTML = g;
const seg = $("seg"); seg.max = n - 1;
function show(i) {
const r = CHAIN[i], best = Math.max(...r.pool_scores);
const v = r.abstained ? `<span class="bad">ABSTAINED · flagged for regeneration</span>` : r.chosen_score >= TAU ? `<span class="ok">ACCEPTED</span>` : `<span class="bad">BELOW τ</span>`;
let h = `<div class="mut small">Segment ${r.segment} of ${n} · scene <code>${r.scene}</code> · seed ${r.seed}</div><div class="stat" style="margin:8px 0"><div class="n b">${f4(r.chosen_score)}</div><div class="l">chosen identity score (τ = ${TAU})</div></div><div>Verdict: <b>${v}</b></div>`;
if (r.segment in REFS) h += `<div class="mut small" style="margin-top:6px">Same segment with the reference-image plugin: ${f4(REFS[r.segment])}</div>`;
$("seginfo").innerHTML = h;
$("pool").tBodies[0].innerHTML = r.pool_scores.map((sc, k) => `<tr><td>Candidate ${k + 1}</td><td class="num ${sc >= TAU ? "ok" : "bad"}">${f4(sc)}</td><td>${sc === best ? "← Fate pick" : ""}</td></tr>`).join("");
const hl = $("hl"); hl.setAttribute("cx", X(i)); hl.setAttribute("cy", Y(r.chosen_score));
}
seg.addEventListener("input", () => show(+seg.value));
$("chart").addEventListener("click", e => { const i = e.target.dataset && e.target.dataset.i; if (i !== undefined) { seg.value = i; show(+i); document.getElementById("inspect").scrollIntoView({ behavior: "smooth" }); } });
show(0);
})().catch(e => document.body.insertAdjacentHTML("afterbegin", `<p style="color:#e5484d;padding:12px">Failed to load evidence: ${e}</p>`));