Download index.html from NagaYu/bleep: direct link, hf CLI and curl.
- Browser
- Download file 21.7 kB
-
https://huggingface.co/spaces/NagaYu/bleep/resolve/main/index.html
- Command line
-
hf download hf://spaces/NagaYu/bleep/index.html
-
curl -L -o index.html https://huggingface.co/spaces/NagaYu/bleep/resolve/main/index.html
21.7 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Bleep — finding sensitive speech without transcribing it</title> | |
| <style> | |
| :root{ | |
| color-scheme: light; | |
| --surface:#fcfcfb; --panel:#ffffff; --ink:#0b0b0b; --ink2:#52514e; | |
| --muted:#8a8983; --grid:#e6e5e1; --rule:#e0dfda; | |
| --a:#2a78d6; --b:#eb6834; --c:#1baf7a; --d:#eda100; --neutral:#c9c8c2; | |
| --warn-bg:#fdf4e7; --warn-br:#eda100; | |
| } | |
| @media (prefers-color-scheme: dark){ | |
| :root:not([data-theme="light"]){ | |
| color-scheme: dark; | |
| --surface:#1a1a19; --panel:#232322; --ink:#ffffff; --ink2:#c3c2b7; | |
| --muted:#8a8983; --grid:#33332f; --rule:#333331; | |
| --a:#3987e5; --b:#d95926; --c:#199e70; --d:#c98500; --neutral:#4d4d48; | |
| --warn-bg:#2a2418; --warn-br:#c98500; | |
| } | |
| } | |
| :root[data-theme="dark"]{ | |
| color-scheme: dark; | |
| --surface:#1a1a19; --panel:#232322; --ink:#ffffff; --ink2:#c3c2b7; | |
| --muted:#8a8983; --grid:#33332f; --rule:#333331; | |
| --a:#3987e5; --b:#d95926; --c:#199e70; --d:#c98500; --neutral:#4d4d48; | |
| --warn-bg:#2a2418; --warn-br:#c98500; | |
| } | |
| *{box-sizing:border-box} | |
| body{margin:0;background:var(--surface);color:var(--ink); | |
| font:15px/1.65 -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif; | |
| -webkit-font-smoothing:antialiased} | |
| .wrap{max-width:940px;margin:0 auto;padding:40px 20px 80px} | |
| h1{font-size:2.1rem;line-height:1.15;margin:0 0 6px;letter-spacing:-.02em} | |
| h2{font-size:1.3rem;margin:44px 0 10px;letter-spacing:-.01em} | |
| h3{font-size:1rem;margin:26px 0 8px;color:var(--ink2)} | |
| p{margin:0 0 14px} | |
| .lede{font-size:1.1rem;color:var(--ink2);margin-bottom:22px} | |
| a{color:var(--a)} | |
| code{font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace; | |
| background:var(--panel);padding:1px 5px;border-radius:4px} | |
| .links{display:flex;flex-wrap:wrap;gap:10px;margin:22px 0 8px} | |
| .links a{display:inline-flex;align-items:center;gap:7px;padding:9px 15px; | |
| border:1px solid var(--rule);border-radius:9px;text-decoration:none; | |
| color:var(--ink);background:var(--panel);font-size:.92rem} | |
| .links a:hover{border-color:var(--a)} | |
| .banner{border:2px solid var(--warn-br);background:var(--warn-bg);border-radius:12px; | |
| padding:14px 18px;margin:18px 0 6px;font-size:1rem} | |
| .banner p{margin:0 0 4px} | |
| .banner p:last-child{margin:0} | |
| .callout{background:var(--warn-bg);border-left:3px solid var(--warn-br); | |
| border-radius:0 10px 10px 0;padding:18px 22px;margin:26px 0} | |
| .callout h2{margin-top:0} | |
| table{border-collapse:collapse;width:100%;margin:14px 0 6px;font-size:.93rem} | |
| th,td{text-align:left;padding:9px 12px;border-bottom:1px solid var(--rule)} | |
| th{color:var(--ink2);font-weight:600;font-size:.82rem;letter-spacing:.03em; | |
| text-transform:uppercase} | |
| td.num{text-align:right;font-variant-numeric:tabular-nums} | |
| tr.hero td{font-weight:700} | |
| .tablewrap{overflow-x:auto} | |
| .note{color:var(--muted);font-size:.86rem;margin-top:6px} | |
| select{font:inherit;padding:8px 11px;border-radius:8px;border:1px solid var(--rule); | |
| background:var(--panel);color:var(--ink);max-width:100%} | |
| .viewer{background:var(--panel);border:1px solid var(--rule);border-radius:12px; | |
| padding:18px;margin:14px 0} | |
| .legend{display:flex;flex-wrap:wrap;gap:16px;margin:12px 0 0;font-size:.85rem; | |
| color:var(--ink2)} | |
| .legend span{display:inline-flex;align-items:center;gap:7px} | |
| .sw{width:13px;height:13px;border-radius:3px;display:inline-block} | |
| figure{margin:18px 0} | |
| figure img{width:100%;height:auto;border:1px solid var(--rule);border-radius:10px; | |
| background:var(--panel)} | |
| figcaption{color:var(--muted);font-size:.85rem;margin-top:7px} | |
| .foot{margin-top:56px;padding-top:22px;border-top:1px solid var(--rule); | |
| color:var(--muted);font-size:.86rem} | |
| @media (max-width:560px){ h1{font-size:1.6rem} .wrap{padding:26px 16px 60px} } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="wrap"> | |
| <h1>Bleep</h1> | |
| <p class="lede">Find <em>where</em> sensitive speech is, without transcribing | |
| <em>what</em> was said.</p> | |
| <p>A small frame-tagging model that reads audio and outputs | |
| <code>(category, start, end)</code> — a spoken digit string here, a | |
| letter-by-letter spelling there — and nothing else. It never produces a | |
| transcript, and it has no mechanism that could: the network takes log-mel | |
| features and emits nine per-frame channels.</p> | |
| <div class="links"> | |
| <a href="https://huggingface.co/NagaYu/bleep-0.09b">🤗 Model</a> | |
| <a href="https://huggingface.co/datasets/NagaYu/bleep-spans">📊 Dataset</a> | |
| </div> | |
| <div class="banner" role="note"> | |
| <p><strong>An empty result means nothing was flagged. It does not mean nothing is there.</strong></p> | |
| <p>This detector is not competitive with an ASR-based pipeline outside the | |
| conditions it was trained on. See the | |
| <a href="https://huggingface.co/NagaYu/bleep-0.09b">model card</a>.</p> | |
| </div> | |
| <div class="callout"> | |
| <h2>STATUS: closed at this problem framing</h2> | |
| <p><strong>The oracle arm — a perfect transcript fed to the same text rules — | |
| scores <span id="oracleRecall">…</span>. <span id="missSplit">…</span> At this | |
| problem framing the room above the baseline is bounded by that gap — | |
| <span id="headroom">…</span> recall on the test split — and this is the | |
| measurement that establishes it.</strong></p> | |
| <p>Retrained to convergence on 2026-10-18. Pre-convergence numbers are kept | |
| beside the new ones. These are final; there will not be a third training | |
| run.</p> | |
| <div class="tablewrap"><table id="armTable"></table></div> | |
| <p class="note" id="armNote"></p> | |
| </div> | |
| <h2>Where it does not hold</h2> | |
| <p id="heldoutText">…</p> | |
| <div class="tablewrap"><table id="heldTable"></table></div> | |
| <h2>Why it was negative before convergence</h2> | |
| <h3>The training conditions were too mild</h3> | |
| <p id="whyCond">…</p> | |
| <h3>The model was badly undertrained</h3> | |
| <p>1500 steps, batch 4, ~1.8 epochs over 9.15 hours — 70 minutes on one | |
| consumer GPU. The validation loss recorded during that run (0.218, 0.200, | |
| 0.191, 0.203, 0.192, 0.183) was measured on freshly re-sampled crops, rose | |
| once, and ended under a learning rate already annealed to 2% of its peak: a | |
| stopped run, not a converged one. (This page previously said the loss was | |
| "still falling monotonically"; that was not accurate.) The retrain ran to a | |
| stopping rule fixed and hashed before it started, and stopped by that rule.</p> | |
| <figure> | |
| <img src="figures/val_curve.light.png" alt="Dev loss against training step for the retrain" | |
| id="figValLight"> | |
| <figcaption>The retrain's dev loss on a fixed set of crops. The dashed line | |
| is the pre-convergence checkpoint on the same crops.</figcaption> | |
| </figure> | |
| <h3>One directional hint</h3> | |
| <p id="whyCat">…</p> | |
| <h2>What is complete and load-bearing</h2> | |
| <p id="heldUp">…</p> | |
| <h2>Timeline viewer</h2> | |
| <p>Real utterances: the first ones from <code>test</code> (conditions the | |
| model was trained on) and from <code>test_heldout_v2</code> (conditions it | |
| never saw). Ground truth against what each detector actually found, at the | |
| operating points the benchmark reports. The pre-convergence model has its own | |
| lane.</p> | |
| <p class="note"><strong>No audio is shipped.</strong> These recordings were | |
| rendered with the macOS system voices, which are licensed for use and not for | |
| republication as a corpus. What you see is a downsampled amplitude envelope — | |
| a few hundred numbers per utterance, enough to draw a waveform, not enough to | |
| reconstruct speech.</p> | |
| <div class="viewer"> | |
| <select id="pick" aria-label="Choose an utterance"></select> | |
| <div id="plot" style="margin-top:14px"></div> | |
| <div class="legend"> | |
| <span><i class="sw" style="background:var(--neutral)"></i>ground truth</span> | |
| <span><i class="sw" style="background:var(--a)"></i>ASR + text PII</span> | |
| <span><i class="sw" style="background:var(--c)"></i>Bleep (converged)</span> | |
| <span><i class="sw" style="background:var(--b)"></i>Bleep (before convergence)</span> | |
| <span><i class="sw" style="background:var(--d)"></i>union</span> | |
| </div> | |
| </div> | |
| <h2>Recall by degradation condition</h2> | |
| <figure> | |
| <img src="figures/fig1_recall_by_condition.light.png" | |
| alt="Recall by degradation condition for each arm, training conditions" | |
| id="figCondLight"> | |
| <figcaption>Training conditions, converged model. The subtitle is generated | |
| from the data, so the chart cannot assert a conclusion the numbers do not | |
| support.</figcaption> | |
| </figure> | |
| <figure> | |
| <img src="figures/fig4_recall_vs_false_alarms.test_heldout_v2.light.png" | |
| alt="Recall against false-alarm rate on unseen degradations" id="figFaLight"> | |
| <figcaption>Unseen conditions: the converged model's whole recall/false-alarm | |
| curve sits to the right of the ASR baseline — no threshold reaches the | |
| baseline's false-alarm rate.</figcaption> | |
| </figure> | |
| <h2>Recall by category</h2> | |
| <figure> | |
| <img src="figures/fig3_recall_by_category.light.png" | |
| alt="Recall by category of sensitive speech" id="figCatLight"> | |
| <figcaption>★ marks the failure modes reported for transcription-first | |
| pipelines. Converged model; the pre-convergence figures are in | |
| <code>figures/pre-convergence/</code>.</figcaption> | |
| </figure> | |
| <h2>What this is not</h2> | |
| <p><strong>Not a redaction guarantee.</strong> Even on the conditions it was | |
| trained on it misses about one region in ten; on conditions it was not, roughly | |
| one in five to one in four, while raising several times the baseline's false | |
| alarms. An empty result means “nothing was flagged”, never “nothing is | |
| there”.</p> | |
| <p><strong>Not a replacement for your ASR-based detector.</strong> It beats the | |
| baseline only on the degradation types it was trained on. It is designed for | |
| union mode, and the union is verified never to drop a region the existing | |
| detector found — zero violations on every utterance of all three evaluation | |
| splits.</p> | |
| <p><strong>Not trained on real audio.</strong> Every recording is synthetic. | |
| No real call, no clinical recording, nothing derived from either, at any | |
| stage. That is also a limitation: TTS speech is far easier to transcribe than | |
| conversation, which is part of why the baseline looks so strong here.</p> | |
| <p><strong>English only.</strong> Japanese generators exist in the code but are | |
| not benchmarked.</p> | |
| <div class="foot"> | |
| <p id="foot">…</p> | |
| <p>Apache-2.0. Negative results are cheap to hide and expensive to | |
| rediscover; closed projects are worth closing in writing.</p> | |
| </div> | |
| </div> | |
| <script> | |
| const NS = "http://www.w3.org/2000/svg"; | |
| const el = (t, a = {}) => { const n = document.createElementNS(NS, t); | |
| for (const k in a) n.setAttribute(k, a[k]); return n; }; | |
| const f3 = v => (v === null || v === undefined || Number.isNaN(v)) ? "—" : v.toFixed(3); | |
| fetch("data.json").then(r => r.json()).then(D => { | |
| const S = D.summary.test, B = D.summary_before.test; | |
| const m = S.matched_fa, arms = S.arms, comp = S.complementarity; | |
| const f1 = v => (v === null || v === undefined) ? "—" : v.toFixed(1); | |
| // ---- status numbers (from the data, not typed) ------------------------ | |
| const oracle = arms.oracle.recall, baseA = arms.A.recall; | |
| document.getElementById("oracleRecall").textContent = f3(oracle); | |
| document.getElementById("headroom").textContent = f3(oracle - baseA); | |
| const C = D.ceiling; | |
| document.getElementById("missSplit").textContent = | |
| `${C.baseline_misses - C.also_missed_by_oracle} of the baseline's ` | |
| + `${C.baseline_misses} misses on the test split are ASR word errors, not ` | |
| + `detector gaps (the oracle misses the other ${C.also_missed_by_oracle} too).`; | |
| // ---- arm table: before and after convergence --------------------------- | |
| const rows = [ | |
| ["A — ASR (whisper-tiny.en) + text PII", arms.A, false], | |
| ["B — ASR (whisper-small.en) + text PII", arms.B, false], | |
| ["C — Bleep alone, converged", arms.C, true], | |
| ["C — Bleep alone, before convergence", B.arms.C, false], | |
| ["D — A ∪ Bleep, converged", arms.D, false], | |
| ["D — A ∪ Bleep, before convergence", B.arms.D, false], | |
| ["oracle — perfect transcript + same rules", arms.oracle, false], | |
| ].filter(r => r[1]); | |
| const t = document.getElementById("armTable"); | |
| t.innerHTML = "<tr><th>arm (test split)</th><th style='text-align:right'>recall</th>" | |
| + "<th style='text-align:right'>false alarms/hour</th></tr>" | |
| + rows.map(([name, a, hero]) => | |
| `<tr class="${hero ? "hero" : ""}"><td>${name}</td>` | |
| + `<td class="num">${f3(a.recall)}</td>` | |
| + `<td class="num">${f1(a.fa_per_hour)}</td></tr>`).join(""); | |
| document.getElementById("armNote").textContent = | |
| `${S.n_utterances} utterances (${S.audio_hours.toFixed(2)} h) from the eight ` | |
| + `degradation conditions the model was trained on, speakers it never saw. ` | |
| + `Bleep's threshold was calibrated on a disjoint split to arm A's measured ` | |
| + `false-alarm rate of ${f1(m.arm_a_fa_per_hour_on_test)}/hour. Of the regions ` | |
| + `arm A missed, the converged model found ` | |
| + `${(comp.asr_misses_rescued_by_bleep * 100).toFixed(0)}% (before convergence: ` | |
| + `${(B.complementarity.asr_misses_rescued_by_bleep * 100).toFixed(0)}%).`; | |
| // ---- held-out: the false-alarm failure --------------------------------- | |
| const H = D.summary.test_heldout, H2 = D.summary.test_heldout_v2; | |
| const ratio = h => h.arms.C.fa_per_hour / h.matched_fa.arm_a_fa_per_hour_on_test; | |
| document.getElementById("heldoutText").textContent = | |
| `On degradation conditions it was not trained on, the threshold carried over ` | |
| + `from the calibration split does not carry its false-alarm rate: the ` | |
| + `converged model raises ${ratio(H).toFixed(1)}–${ratio(H2).toFixed(1)}× the ` | |
| + `baseline's false alarms, and no threshold brings it down to the baseline's ` | |
| + `rate. None of these recall comparisons is at a matched false-alarm rate.`; | |
| const ht = document.getElementById("heldTable"); | |
| const hrow = (name, h) => `<tr><td>${name}</td>` | |
| + `<td class="num">${f3(h.arms.A.recall)} · ${f1(h.arms.A.fa_per_hour)}</td>` | |
| + `<td class="num">${f3(h.arms.C.recall)} · ${f1(h.arms.C.fa_per_hour)}</td></tr>`; | |
| ht.innerHTML = "<tr><th>held-out split</th><th style='text-align:right'>ASR baseline: recall · FA/h</th>" | |
| + "<th style='text-align:right'>Bleep, converged: recall · FA/h</th></tr>" | |
| + hrow("test_heldout (2 of 5 conditions later trained)", H) | |
| + hrow("test_heldout_v2 (all 5 conditions unseen)", H2); | |
| // ---- data-derived prose --------------------------------------------- | |
| const pc = S.per_condition, ph = H.per_condition, ph2 = H2.per_condition; | |
| document.getElementById("whyCond").textContent = | |
| `On the training-condition test split the ASR baseline is essentially flat: ` | |
| + `${f3(pc.clean.A)} on clean audio and ${f3(pc.telephony_8k.A)} at 8 kHz — ` | |
| + `i.e. better than clean. A band-limit plus G.711 is not a hard condition ` | |
| + `for a modern ASR on hyper-articulated TTS speech. The collapse appeared ` | |
| + `only in the harsher held-out conditions: ` | |
| + `${f3(ph.overlap_0db_three_way.A)} at 0 dB three-way overlap and ` | |
| + `${f3(ph.telephony_overlap_3db.A)} at narrowband-plus-overlap. For the ` | |
| + `retrain those two were moved into training; of five new unseen conditions ` | |
| + `the baseline collapses only under overlap again (` | |
| + `${f3(ph2.overlap_minus3db.A)} at −3 dB).`; | |
| const catB = B.per_category, cat = S.per_category; | |
| const best = Object.entries(catB).filter(([, v]) => v.C !== null) | |
| .sort((a, b) => b[1].C - a[1].C).slice(0, 2); | |
| document.getElementById("whyCat").textContent = | |
| `Before convergence, Bleep's per-category recall had the shape the acoustic ` | |
| + `argument predicts. Its best categories were ${best.map(([k, v]) => | |
| k.replace(/_/g, " ").toLowerCase() + " (" + f3(v.C) + ")").join(" and ")}` | |
| + ` — the two with the most distinctive rhythm — against ~0.00 for run-on ` | |
| + `digits, money and identifiers. After convergence those two reach ` | |
| + `${best.map(([k]) => f3(cat[k].C)).join(" and ")}.`; | |
| const sp = S.speed.bleep, asr = S.speed.asr_arms_rtf; | |
| document.getElementById("heldUp").textContent = | |
| `Speed: ${sp.rtf_median} real-time factor on CPU with the front end ` | |
| + `included — ${sp.xrealtime_best}× real time, ` | |
| + `${(asr.A / sp.rtf_median).toFixed(1)}× faster than the cheapest ASR arm ` | |
| + `and ${(asr.B / sp.rtf_median).toFixed(0)}× faster than the better one; ` | |
| + `on the Apple Neural Engine via Core ML, about 0.002 real-time factor. ` | |
| + `${(sp.param_count / 1e6).toFixed(1)} M parameters. The no-content invariant ` | |
| + `is enforced structurally by tests (an AST walk over the module graph); a ` | |
| + `span carries only start, end, label, score and source. The union never ` | |
| + `drops a region the existing detector found: zero violations on every ` | |
| + `utterance of all three evaluation splits. Chunked inference is bit-exact ` | |
| + `against whole-file inference, the receptive field is capped at 8.98 s on ` | |
| + `purpose, and redaction writes a review plan rather than touching audio.`; | |
| document.getElementById("foot").textContent = | |
| `Converged benchmark generated ${D.generated_utc}; pre-convergence benchmark ` | |
| + `${D.generated_utc_before}. Every number on this page is read from the ` | |
| + `benchmarks' own JSON by the page itself.`; | |
| // ---- timeline viewer ------------------------------------------------- | |
| const pick = document.getElementById("pick"); | |
| D.examples.forEach((e, i) => { | |
| const o = document.createElement("option"); | |
| o.value = i; | |
| o.textContent = `${e.split === "test" ? "trained" : "UNSEEN"} · ` | |
| + `${e.condition.replace(/_/g, " ")} — ${e.duration.toFixed(1)}s ` | |
| + `(${e.truth.length} sensitive region${e.truth.length === 1 ? "" : "s"})`; | |
| pick.appendChild(o); | |
| }); | |
| const LANES = [ | |
| ["ground truth", "truth", "var(--neutral)"], | |
| ["ASR + text PII", "asr", "var(--a)"], | |
| ["Bleep", "bleep", "var(--c)"], | |
| ["Bleep (before)", "bleep_before", "var(--b)"], | |
| ["union", "union", "var(--d)"], | |
| ]; | |
| function draw(i) { | |
| const e = D.examples[i]; | |
| const W = 900, padL = 104, padR = 14, wave = 62, laneH = 26, gap = 7; | |
| const H = wave + 18 + LANES.length * (laneH + gap) + 30; | |
| const plotW = W - padL - padR; | |
| const x = s => padL + (s / e.duration) * plotW; | |
| const svg = el("svg", {viewBox: `0 0 ${W} ${H}`, width: "100%", | |
| role: "img", "aria-label": `Detections for ${e.utt_id}`}); | |
| svg.style.overflow = "visible"; | |
| // waveform envelope | |
| const n = e.envelope.length, bw = plotW / n; | |
| e.envelope.forEach((v, k) => { | |
| const h = Math.max(1, v * wave); | |
| svg.appendChild(el("rect", {x: padL + k * bw, y: wave / 2 - h / 2 + 4, | |
| width: Math.max(0.8, bw - 0.4), height: h, fill: "var(--neutral)"})); | |
| }); | |
| // time axis | |
| const step = e.duration > 18 ? 5 : e.duration > 8 ? 2 : 1; | |
| for (let s = 0; s <= e.duration + 1e-6; s += step) { | |
| svg.appendChild(el("line", {x1: x(s), x2: x(s), y1: 0, y2: H - 22, | |
| stroke: "var(--grid)", "stroke-width": 1})); | |
| const lab = el("text", {x: x(s), y: H - 6, "text-anchor": "middle", | |
| fill: "var(--muted)", "font-size": 11}); | |
| lab.textContent = s + "s"; | |
| svg.appendChild(lab); | |
| } | |
| LANES.forEach(([label, key, colour], li) => { | |
| const y = wave + 18 + li * (laneH + gap); | |
| const lab = el("text", {x: padL - 12, y: y + laneH / 2 + 4, | |
| "text-anchor": "end", fill: "var(--ink2)", "font-size": 12}); | |
| lab.textContent = label; | |
| svg.appendChild(lab); | |
| svg.appendChild(el("rect", {x: padL, y, width: plotW, height: laneH, | |
| fill: "var(--grid)", opacity: .35, rx: 5})); | |
| (e[key] || []).forEach(s => { | |
| const w = Math.max(2, x(s.end) - x(s.start)); | |
| const r = el("rect", {x: x(s.start), y, width: w, height: laneH, | |
| fill: colour, rx: 4}); | |
| const ttl = el("title"); | |
| ttl.textContent = `${s.label} · ${s.start.toFixed(2)}–${s.end.toFixed(2)}s`; | |
| r.appendChild(ttl); | |
| svg.appendChild(r); | |
| }); | |
| if (!(e[key] || []).length) { | |
| const none = el("text", {x: padL + 9, y: y + laneH / 2 + 4, | |
| fill: "var(--muted)", "font-size": 11}); | |
| none.textContent = "nothing found"; | |
| svg.appendChild(none); | |
| } | |
| }); | |
| const host = document.getElementById("plot"); | |
| host.innerHTML = ""; | |
| host.appendChild(svg); | |
| const cats = [...new Set(e.truth.map(s => s.label))].join(", ").toLowerCase(); | |
| const cap = document.createElement("p"); | |
| cap.className = "note"; | |
| cap.textContent = `${e.utt_id} · condition ${e.condition.replace(/_/g, " ")}` | |
| + (cats ? ` · ground-truth categories: ${cats.replace(/_/g, " ")}` : ""); | |
| host.appendChild(cap); | |
| } | |
| pick.addEventListener("change", () => draw(+pick.value)); | |
| draw(0); | |
| // dark-mode figure swap | |
| const swap = dark => { | |
| [["figCondLight", "fig1_recall_by_condition"], | |
| ["figFaLight", "fig4_recall_vs_false_alarms.test_heldout_v2"], | |
| ["figValLight", "val_curve"], | |
| ["figCatLight", "fig3_recall_by_category"]].forEach(([id, base]) => { | |
| const n = document.getElementById(id); | |
| if (n) n.src = `figures/${base}.${dark ? "dark" : "light"}.png`; | |
| }); | |
| }; | |
| const mq = window.matchMedia("(prefers-color-scheme: dark)"); | |
| swap(mq.matches); | |
| mq.addEventListener("change", ev => swap(ev.matches)); | |
| }); | |
| </script> | |
| </body> | |
| </html> | |