Spaces:
Running
Running
Commit History
-
Species tree: drop viruses + retitle (25 species, 571,789 sequences)
Removes SARS-CoV-2 and HIV-1 from the §7 dendrogram since viruses are not part of the tree of life. Retitles the section to "How Carbon groups species from DNA", reframes the lede as a representation-geometry question (not a phylogenetic claim), and updates the takeaway to use kingdom-correct terminology ("animals cluster with animals" rather than "vertebrates cluster with vertebrates"). §6 UMAP is intentionally left intact. Recomputes Ward + UPGMA linkages and dendrogram layouts on the trimmed 25-leaf distance matrix; removes the viruses kingdom from the build script, the demo legend, and the tree-tip color table. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>a54539b
-
Merge branch 'main' of hf.co:spaces/HuggingFaceBio/carbon-demo
755132f -
Merge branch 'main' of hf.co:spaces/HuggingFaceBio/carbon-demo
Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # demo.html187590e -
Sandbox: fix line overflow when seq block measured before font load
The bases-per-line calc was attaching a probe to document.body with hand-mirrored font CSS, then dividing the seq block width by the measured glyph width. That drifted from the real rendering context in two ways: 1. If JetBrains Mono hadn't finished loading at measure-time, the fallback monospace was narrower → blockW underestimated → bpl too large → rendered lines overflowed the container. 2. If the sandbox panel was still display:none when first measured (landing on #intro and switching tabs later), clientWidth was 0 and the probe-based metrics never got refreshed against the real layout once the panel became visible. Three coordinated fixes: - Move the probe inside the seq block itself so it inherits the real font / letter-spacing / feature settings. - tabs.js emits a tab:changed CustomEvent on every tab switch; sandbox listens and drops charMetrics + re-renders on the next frame once its panel is actually laid out. - After each render, compare the first line'…e22bb4b -
Footer: editorial site footer with collab credit + partner logos
Adds a multi-row site footer in demo.html (collab block with 4 partner stamps, three-column identity/resources/sections strip, legal hairline) backed by a full rewrite of assets/styles/footer.css. Drops partner artwork under img/partners/ (Hugging Face, Zhongguancun Academy, TIGEM, Federico II) plus their raw sources for traceability. Also bundles a few small fixes uncovered while wiring the footer: - demo.html banner: point Tech report to the paperswithcode landing - sandbox.js: clear the .empty placeholder when incrementalRender takes over straight from idle, so generated lines stop rendering inline - section-vep.css: allow horizontal scroll on .vep-window so the 60bp mono stack survives narrow viewports without breaking row alignment - intro/species/controls/recipe/banner CSS: footer-adjacent polish Co-authored-by: Cursor <cursoragent@cursor.com>5dfaccc -
Demo polish + scripted reel tour
§1-§7 section titles rewritten (Autocomplete for the DNA, Recognizing gene structure, Predicting mutation effects, Species specific generation, From DNA to proteins, Mapping out genomes, Reconstructing the tree of life) with matching lede rewrites; §3 status pill moves to the top-right of the DNA box and forest-bar viewBox tightens to rowH=46 so each row fits a single reel frame; social banner reflects the 393,216 bp context. app.py adds a DEV=1 mode that re-reads templates per request (so edits to demo.html / social-banner.html show up without restarting uvicorn) and exposes /reel for the scripted tour. social_reel.html drives the tour: banner stage now adopts the iframe size (no letterbox, no crop), ken-burns zoom is gone, scene-to-scene transitions are a vertical slide on .stage-frame, and the logo / thumb contact sheets are hidden in the embedded banner so only the hero shows. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>7ae5802 -
Demo polish: SEO/AI-agent discoverability + new hexagonal logo + §1 helix per-letter fade + sandbox empty-state
- Discoverability surface: robots.txt, sitemap.xml, llms.txt, JSON-LD/OG/Twitter metadata in demo.html; app.py templates demo + social-banner with {{SITE_URL}} resolved per-request from X-Forwarded-*; Dockerfile COPYs the new files. - New hexagonal Carbon mark (img/logo.svg) plus black square/rectangle lockups used by the social-banner contact sheet. - social-banner: noindex, doubles as a brand contact sheet under the stage with native-size square and rectangle lockups for one-shot screenshots. - §1 intro helix: per-letter depth-aware fade — front-strand letter at each crossing stays readable while its back-strand sibling recedes, instead of both going equally ghosted. - Sandbox empty-state: centered, white-on-white, lighter contrast so the placeholder reads as a hint rather than a block. - New §X efficiency section script wired into demo.html. Co-authored-by: Cursor <cursoragent@cursor.com>1d5de93 -
§3 VEP: replace variant set with audited 8-pick spread
Old set: 6 variants, two disagreed with ClinVar at the 4 kb scoring window, one was effectively invisible, one had a contested clinical classification (TP53 Pro72Arg). Replaced with 8 picks (6 Pathogenic + 1 Risk + 1 Benign), all checked against Carbon-3B at the demo's window length: HBB, BRCA2, TP53 c.712T>A, F9, LDLR splice donor, VHL stop, LRRK2 G2019S, VHL 3' UTR benign. The two VHL rows are paired by design as the narrative payoff (same gene, opposite verdicts: −323 nats vs ≈0). Regenerated data/variants.json end to end via fetch_variants.py + precompute_vep against the live /score endpoint; rewrote GENE_INFO / VARIANT_DESC for the new genes; updated the VEP takeaway to point at the VHL pair instead of the retired sign-disagreement framing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>41739ad -
§0 helix: refactor rung letter placement around midline + expose MIN_LETTER_HALF knob
Co-authored-by: Cursor <cursoragent@cursor.com>5798713 -
Demo polish: colorblind-safe §6 strand; §5 completion-fold; §1 helix occlusion; §7 score chip; logo SVG; §8 evals refresh
- §6 UMAP: strand palette switched from green/red to Okabe-Ito blue/vermillion so the +/- coloring survives deuteranopia and protanopia (the previous pair collapsed to two near-identical grays under both common CVD types). - §5 Folding: new completion-fold pipeline (75% CDS prompt → 25% predicted → fold the C-term tail with ESMFold); mrna-info row reads the prompt/predict ratio for completion-fold genes, falls back to the original genomic→mRNA→ORF chain for legacy fixtures. genes.json gains the fold_setup / fold_example fields and a sections[] tag to scope the showcase set per panel. - §1 Intro: helix occlusion now splits each strand at depth-zero PEAKS rather than centerline crossings, so the "behind" arcs alternate between upper and lower lobes and rungs occlude correctly under the front strand. Edge-touching arcs render solid (no ghosted 5'/3' label ties). - §7 Tree: agreement-score chip redesigned as a typographic stat block — percentage in Carbon green + raw …f5d37e0 -
§4 Species: anchor prompt to 2nd exon, drop zebrafish
- fetch_species.py: also capture per-species exon coords from Ensembl, translated into 0-based offsets in the trimmed seq - species.js: new getPromptWindow() — anchors prefixEnd 35 bp into the 2nd exon (like §1's gene completion); slides prefixStart back by the user-selected prefixLen; falls back to flat slice when exon 2 isn't visible. Always render the prompt (no more "click run all" placeholder). Per-row "{N} bp prompt" note. - species.json: regenerated with exon data; zebrafish dropped (~450 My drift made the row look like noise next to mammals + bird) - demo.html §4 lede/takeaway: reflect new framing and dropped species2c5ccd8 -
Demo polish: header specs, primer rewrite, hide endpoint URL, tab rename
- Banner: 393,216 bp context (was 49,152); footer model badge removed - Intro tab: rewrite primer §0/§1/§3/§4 paragraphs; clarify 1T tokens (6T bp) - DNA Lab intro: use "Carbon-3B" to differentiate from upcoming releases - Hide endpoint URL in frontend (sandbox header + code snippets); /config no longer returns it; backend still uses real ENDPOINT_URL via env/default - Code snippets: rename tabs to "API" / "transformers", generic https://<your-endpoint>/v1/ placeholder, escape angle brackets - Sandbox: fold "Connected to {model}" into the Input card header - Rename tabs demo->dna-lab and model->recipe (URLs now #dna-lab, #recipe)3cf1b0c -
§6 UMAP: highlight curated gene sets (HOX, mitochondrial) + per-mode descriptions
Adds a second toolbar row of "highlight" pills next to the existing colour-by controls. Each pill recolors the WebGL scatter via a 2-class palette (dimmed grey ghost + vivid foreground), so the highlight is a view of the existing points, not new geometry on top. Identity matching is coord-snap via the spatial grid already built for hover, since the bin is species-bucketed and the CSV's row_idx doesn't line up with the bin's row order. Adds a per-mode descriptive paragraph above the chart explaining what each axis or gene set actually is (biotypes, GC content, HOX, mt-DNA), and moves the navigation hint to a right-aligned slot in the stat row. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>468dae5 -
§6 cat gutter nudged right; sandbox output card bottom padding
- results.js: shift category labels and hairline brackets ~22 px right so they sit close to their task rows instead of pinned to the svg edge. - sandbox.css: bump .sb-card__body padding-bottom 0 → 22 px on the sandbox panel so the output sequence block doesn't kiss the card edge. Co-authored-by: Cursor <cursoragent@cursor.com>7b77685 -
Demo polish: Intro visuals, §3 + §6 charts readability, code-snippet UI
Intro tab (§1–§5) - §1 Atoms: bold green base letters, two-line label (mono A/C/G/T over full name). - §2 Helix: redesign à la 3D banner — letters sit *between* the two strands (helix–base–base–helix), rungs interrupted around them, faded at crossings instead of culled so there are no bald gaps; thinner strands, 5'/3' tags symmetric on both ends, tighter top spacing, more breathing room at the bottom of the card. New base-pair legend: A=T / G≡C in big green type with H-bond meta + caption. - §3 + §4 Gene strip: horizontally centred; track-labels now have a "LEGEND" prefix and §4 gets a duplicated legend. - §5 Translate / fold / 3D viewer: codon-AA grid + caption centred, fold-arrow margins trimmed, 3Dmol viewer 340 → 280 px, three-tier protein caption (sans-serif title 19px / italic desc / mono meta with clickable PDB link). Slow editorial spin (0.4 → 0.15), wheel events on the viewer container forwarded to window scroll so the page no longer traps when the curs…5da533e
-
Intro tab + central-dogma primer + em-dash sweep
- New Intro tab as default landing: release blurb, tab-nav guide (bullet list with banner-style links), and an optional "quick primer in genetics" §1-§5 walkthrough using the existing section--two-col + .demo primitives. - Primer visuals: skeletal-formula SVGs for the four bases, static DNA helix (~10 bp/turn), gene strip (promoter / exons / introns), splice diagram with transcribe arrows, 10-column codon to amino-acid table with peptide-bond chain, and a live 3Dmol.js viewer of human hemoglobin (PDB 1A3N) bundled in assets/data/ for fast first paint. - Lazy-init the 3D viewer via MutationObserver on the panel's .active class, so visitors who deep-link to #demo / #sandbox skip the fetch. - Tabs renamed: Demo to DNA Lab, Model to Carbon Recipe (display labels only; data-tab slugs and URL hashes stay 'demo' / 'model' for backwards-compat). - Banner: add Code placeholder link to banner-links; tab buttons use min-width + nowrap so "Carbon Recipe" stays on one line. - …5ea40ce -
§6 UMAP: snap to default framing when wheel zoom-out hits MIN_SCALE
Previously, dezooming with an off-centre cursor would land at MIN_SCALE but with tx/ty stranded wherever the zoom-around-cursor formula left them — e.g. Vertebrates half off-screen + white band on top. Visibly broke the "fully zoomed out = editorial bottom-right framing" promise. Fix: in the wheel handler, when newScale clamps to MIN_SCALE, snap tx/ty back to DEFAULT_VIEW instead of running the zoom-around-cursor math. The user can still drag-pan after that; the snap only fires the moment we reach the floor zoom. Co-authored-by: Cursor <cursoragent@cursor.com>d64b553 -
Carry over §2 Variant rework + §1/§4 polish dropped by the -s ours merge
The previous merge (32c9c3a) used -s ours to keep the local tree intact while preserving Leandro's two upstream commits (57bce37 §2 Variant rework, 176caed banner wordmark) in the history for attribution. Most of those changes had already been adapted locally to the new modular CSS/JS split, but the actual content carry-over wasn't yet committed. This commit applies the remaining ports on top of the merge. §3 VEP (was §2 in Leandro's tree) — refonte complète - 4 kb scoring window: fetch_variants.py WINDOW 60 → 4002 (well below the 8 kb eval recipe but enough that all 3 pathogenic variants land on the correct side of zero). data/variants.json regenerated. - Two-row sequence display: original above, click-editable mutation below, with arrows on every base that differs from the original. Click cycles A → C → G → T, debounced 500 ms rescore against /score. - Per-row log-likelihood score on the right (green if more likely, red if less likely); mutation score blanks to '—' while a…1d3e72f -
§6 UMAP: bias default view toward the dense bottom-right clusters
Lock min zoom to ~1.35 with a bottom-right offset (tx=-0.18, ty=0.15) so the landing frame skips the wide empty band along the top and ~40% of the viewport stops going to whitespace. Min-zoom matches the default view, so visitors can pan/zoom around but never reach the fit-everything view where the clusters drown in margin. Co-authored-by: Cursor <cursoragent@cursor.com>451c3d8 -
Sandbox card layout, sticky-nav breadcrumb, drop §2/§3 score buttons
- Sandbox: refactor into stacked cards (sb-card with eyebrow/title/hint headers, Input → Output) plus a Connected-to strip up top, replacing the flat wall of controls. - Sticky nav: add a CARBON / huggingfacebio-carbon-3b breadcrumb on the left of the sticky strip so the "you're on the Carbon page" cue stays visible after the hero scrolls out. - §2 (VEP) and §3 (Track): drop the manual ▶ score / score all buttons. §3 tracks are precomputed (logprobs ship in data/genes.json), so the toolbar is just a gene selector now; §2 will auto-score on select. - Misc: app.py, precompute.py, controls.css, layout.css, section-tree.css, banner.js and data/genes.json picked up along the way. - Add social-banner.html. Co-authored-by: Cursor <cursoragent@cursor.com>b64beb5 -
Hero refresh + sticky tab nav + section polish
Banner / hero - Desaturate the DNA helix palette (banner.js TINT) so the canvas blends into the paper rather than punching through it. - Cursor caret trimmed from the top so it stops poking above the N's cap height while keeping its baseline aligned with the wordmark. Sticky tab nav - New strip (#tab-nav-sticky) slides in from the top once the in-banner #tab-nav scrolls out of view (IntersectionObserver in tabs.js toggling .is-tabs-stuck on <body>). - Styled as a slice of the banner: same paper backing, dotted grain + green vertical stripes, same bottom hairline. Tabs reuse the in-banner colour scheme with bumped #b8b5a6 borders, sharp corners, top liseré on the active tab, and a margin-bottom: -1px trick so the active card bleeds into the page paper underneath. - Promoted --paper / --ink / --green / --hairline / --muted to :root so the sticky nav (a sibling of .carbon-banner, not a descendant) can resolve them. Section layout - §1 tokenizer: 1-mer and 6-mer colum…1cc98cf
-
Split demo.html into modular CSS/JS assets
demo.html had grown to 6477 lines with a single inline <style> (1240 lines) and a single inline <script> (4358 lines) — every change meant hunting through one giant scrollback and risked breaking unrelated sections. Extracted into /assets/: styles/ 14 files, ~1280 lines: base, header, banner, layout (incl. new section--two-col), controls, sequence, section-{folding,umap,tree,vep,species}, recipe, sandbox, footer js/shared/ helpers.js (lerp, logprobRgb, renderSeq…) + config.js (fetchConfig, loadConfig, loadGenes) js/sections/ one IIFE per demo card: completion, vep, track, species, folding, tokenizer, loss, data, architecture, sandbox, umap, tree js/ banner.js (DNA helix Canvas 2D), tabs.js (hash routing + bootstrap loadConfig) Strategy: plain <script> tags, not ES modules. Each IIFE was extracted verbatim and globals stay global — minimum behavioural risk. Migrating …39a61da