Model-Notebook / index.html
danielrosehill's picture
Model Notebook page
8bc47ff verified
Raw History Blame Contribute Delete
5.01 kB
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Model Notebook</title><link rel="stylesheet" href="style.css">
<style>
.chips{display:flex;flex-wrap:wrap;gap:6px}.chip{background:var(--soft);color:var(--accent);padding:1px 8px;border-radius:4px;font-size:.8rem}
.entry{border-top:1px dashed var(--line);padding-top:8px}.entry:first-of-type{border-top:0;padding-top:0}
.entry .uc{font-weight:600;font-size:.92rem}.entry .d{color:var(--muted);font-size:.8rem}
.entry details{font-size:.88rem;color:var(--muted)}.entry pre{white-space:pre-wrap;font:inherit;margin:4px 0 0}
</style></head>
<body><main>
<h1>Model Notebook</h1>
<p class="lede">Models I've tried and think are excellent, with my notes on what I used each one for. Every model here is in the Favorite Models collection; the notes live in the Model Notes dataset.</p>
<nav class="links">
<a href="https://huggingface.co/collections/danielrosehill/favorite-models-6af1e78287631fdb52e64661" target="_blank" rel="noopener">Favorite Models collection</a>
<a href="https://huggingface.co/datasets/danielrosehill/Model-Notes" target="_blank" rel="noopener">Model Notes dataset</a>
<a href="https://huggingface.co/spaces/danielrosehill/Start-Here" target="_blank" rel="noopener">Start Here</a>
<a href="https://huggingface.co/danielrosehill" target="_blank" rel="noopener">danielrosehill</a>
</nav>
<div class="stats" id="stats"></div>
<div class="controls">
<input id="q" type="search" placeholder="Search models, use cases, notes" aria-label="Search">
<select id="task" aria-label="Task"><option value="">All tasks</option></select>
<select id="sort" aria-label="Sort"><option value="added">Newest added</option><option value="noted">Latest note</option><option value="name">Name</option></select>
</div>
<div class="grid" id="list"></div>
<footer>Read live from <code>danielrosehill/Model-Notes</code>. <span id="count"></span></footer>
</main>
<script>
const SRC="https://huggingface.co/datasets/danielrosehill/Model-Notes/resolve/main/notes.jsonl";
const $=id=>document.getElementById(id);
const esc=s=>String(s??"").replace(/[&<>"]/g,c=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"}[c]));
let models=[];
function group(rows){
const m=new Map();
for(const r of rows){
if(!m.has(r.model))m.set(r.model,{...r,entries:[],tags:new Set(),uses:new Set()});
const g=m.get(r.model);
g.entries.push(r);(r.tags||[]).forEach(t=>g.tags.add(t));if(r.use_case)g.uses.add(r.use_case);
if(r.added&&(!g.added||r.added<g.added))g.added=r.added;
g.last=g.entries.map(e=>e.noted||"").sort().pop();
for(const k of["pipeline_tag","library","license","params"])if(r[k])g[k]=r[k];
}
for(const g of m.values())g.entries.sort((a,b)=>(b.noted||"").localeCompare(a.noted||""));
return[...m.values()];
}
function render(){
const q=$("q").value.toLowerCase(),t=$("task").value,s=$("sort").value;
let l=models.filter(g=>(!t||g.pipeline_tag===t)&&(!q||JSON.stringify([g.model,[...g.tags],g.entries]).toLowerCase().includes(q)));
l.sort(s==="name"?(a,b)=>a.model.localeCompare(b.model):s==="noted"?(a,b)=>(b.last||"").localeCompare(a.last||""):(a,b)=>(b.added||"").localeCompare(a.added||""));
$("list").innerHTML=l.length?l.map(g=>`<article class="card">
<h3><a href="https://huggingface.co/${esc(g.model)}" target="_blank" rel="noopener">${esc(g.model)}</a></h3>
<div class="chips">${[...g.uses].map(u=>`<span class="chip">${esc(u)}</span>`).join("")}${[...g.tags].map(u=>`<span class="chip" style="background:#eee;color:var(--muted)">${esc(u)}</span>`).join("")}</div>
${g.entries.map(e=>`<div class="entry"><div class="uc">${esc(e.use_case)}</div><p>${esc(e.summary)}</p>${e.notes?`<details><summary>Scratch notes</summary><pre>${esc(e.notes)}</pre></details>`:""}<div class="d">Noted ${esc(e.noted)}</div></div>`).join("")}
<div class="meta"><span>Added ${esc(g.added)}</span>${g.pipeline_tag?`<span>${esc(g.pipeline_tag)}</span>`:""}${g.params?`<span>${esc(g.params)}</span>`:""}${g.license?`<span>${esc(g.license)}</span>`:""}</div>
</article>`).join(""):`<p class="empty">${models.length?"Nothing matches.":"No notes yet."}</p>`;
$("count").textContent=`${l.length} of ${models.length} models shown.`;
}
fetch(SRC,{cache:"no-store"}).then(r=>r.ok?r.text():"").then(txt=>{
const rows=txt.split("\n").filter(x=>x.trim()).map(x=>JSON.parse(x));
models=group(rows);
const tasks=[...new Set(models.map(g=>g.pipeline_tag).filter(Boolean))].sort();
$("task").innerHTML+=tasks.map(t=>`<option>${esc(t)}</option>`).join("");
const uses=new Set(rows.map(r=>r.use_case).filter(Boolean));
$("stats").innerHTML=`<span><b>${models.length}</b> models</span><span><b>${rows.length}</b> notes</span><span><b>${uses.size}</b> use cases</span>`;
render();
}).catch(e=>{$("list").innerHTML=`<p class="empty">Couldn't load notes: ${esc(e)}</p>`});
["q","task","sort"].forEach(id=>$(id).addEventListener("input",render));
</script></body></html>