danielrosehill commited on
Commit
8bc47ff
·
verified ·
1 Parent(s): 73266bd

Model Notebook page

Browse files
Files changed (3) hide show
  1. README.md +10 -4
  2. index.html +67 -18
  3. style.css +31 -28
README.md CHANGED
@@ -1,10 +1,16 @@
1
  ---
2
  title: Model Notebook
3
- emoji: 😻
4
- colorFrom: blue
5
- colorTo: green
6
  sdk: static
 
7
  pinned: false
 
 
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
  title: Model Notebook
3
+ emoji: 📓
4
+ colorFrom: green
5
+ colorTo: gray
6
  sdk: static
7
+ app_file: index.html
8
  pinned: false
9
+ license: mit
10
+ datasets:
11
+ - danielrosehill/Model-Notes
12
+ short_description: My notes on favourite models and their use cases
13
  ---
14
 
15
+ Reads `danielrosehill/Model-Notes` (`notes.jsonl`) live in the browser, so new notes show up
16
+ without redeploying. Source: `personal-admin/Hugging-Face-Manager/spaces/Model-Notebook/`.
index.html CHANGED
@@ -1,19 +1,68 @@
1
  <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <!doctype html>
2
+ <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
3
+ <title>Model Notebook</title><link rel="stylesheet" href="style.css">
4
+ <style>
5
+ .chips{display:flex;flex-wrap:wrap;gap:6px}.chip{background:var(--soft);color:var(--accent);padding:1px 8px;border-radius:4px;font-size:.8rem}
6
+ .entry{border-top:1px dashed var(--line);padding-top:8px}.entry:first-of-type{border-top:0;padding-top:0}
7
+ .entry .uc{font-weight:600;font-size:.92rem}.entry .d{color:var(--muted);font-size:.8rem}
8
+ .entry details{font-size:.88rem;color:var(--muted)}.entry pre{white-space:pre-wrap;font:inherit;margin:4px 0 0}
9
+ </style></head>
10
+ <body><main>
11
+ <h1>Model Notebook</h1>
12
+ <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>
13
+ <nav class="links">
14
+ <a href="https://huggingface.co/collections/danielrosehill/favorite-models-6af1e78287631fdb52e64661" target="_blank" rel="noopener">Favorite Models collection</a>
15
+ <a href="https://huggingface.co/datasets/danielrosehill/Model-Notes" target="_blank" rel="noopener">Model Notes dataset</a>
16
+ <a href="https://huggingface.co/spaces/danielrosehill/Start-Here" target="_blank" rel="noopener">Start Here</a>
17
+ <a href="https://huggingface.co/danielrosehill" target="_blank" rel="noopener">danielrosehill</a>
18
+ </nav>
19
+ <div class="stats" id="stats"></div>
20
+ <div class="controls">
21
+ <input id="q" type="search" placeholder="Search models, use cases, notes" aria-label="Search">
22
+ <select id="task" aria-label="Task"><option value="">All tasks</option></select>
23
+ <select id="sort" aria-label="Sort"><option value="added">Newest added</option><option value="noted">Latest note</option><option value="name">Name</option></select>
24
+ </div>
25
+ <div class="grid" id="list"></div>
26
+ <footer>Read live from <code>danielrosehill/Model-Notes</code>. <span id="count"></span></footer>
27
+ </main>
28
+ <script>
29
+ const SRC="https://huggingface.co/datasets/danielrosehill/Model-Notes/resolve/main/notes.jsonl";
30
+ const $=id=>document.getElementById(id);
31
+ const esc=s=>String(s??"").replace(/[&<>"]/g,c=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"}[c]));
32
+ let models=[];
33
+ function group(rows){
34
+ const m=new Map();
35
+ for(const r of rows){
36
+ if(!m.has(r.model))m.set(r.model,{...r,entries:[],tags:new Set(),uses:new Set()});
37
+ const g=m.get(r.model);
38
+ g.entries.push(r);(r.tags||[]).forEach(t=>g.tags.add(t));if(r.use_case)g.uses.add(r.use_case);
39
+ if(r.added&&(!g.added||r.added<g.added))g.added=r.added;
40
+ g.last=g.entries.map(e=>e.noted||"").sort().pop();
41
+ for(const k of["pipeline_tag","library","license","params"])if(r[k])g[k]=r[k];
42
+ }
43
+ for(const g of m.values())g.entries.sort((a,b)=>(b.noted||"").localeCompare(a.noted||""));
44
+ return[...m.values()];
45
+ }
46
+ function render(){
47
+ const q=$("q").value.toLowerCase(),t=$("task").value,s=$("sort").value;
48
+ let l=models.filter(g=>(!t||g.pipeline_tag===t)&&(!q||JSON.stringify([g.model,[...g.tags],g.entries]).toLowerCase().includes(q)));
49
+ 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||""));
50
+ $("list").innerHTML=l.length?l.map(g=>`<article class="card">
51
+ <h3><a href="https://huggingface.co/${esc(g.model)}" target="_blank" rel="noopener">${esc(g.model)}</a></h3>
52
+ <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>
53
+ ${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("")}
54
+ <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>
55
+ </article>`).join(""):`<p class="empty">${models.length?"Nothing matches.":"No notes yet."}</p>`;
56
+ $("count").textContent=`${l.length} of ${models.length} models shown.`;
57
+ }
58
+ fetch(SRC,{cache:"no-store"}).then(r=>r.ok?r.text():"").then(txt=>{
59
+ const rows=txt.split("\n").filter(x=>x.trim()).map(x=>JSON.parse(x));
60
+ models=group(rows);
61
+ const tasks=[...new Set(models.map(g=>g.pipeline_tag).filter(Boolean))].sort();
62
+ $("task").innerHTML+=tasks.map(t=>`<option>${esc(t)}</option>`).join("");
63
+ const uses=new Set(rows.map(r=>r.use_case).filter(Boolean));
64
+ $("stats").innerHTML=`<span><b>${models.length}</b> models</span><span><b>${rows.length}</b> notes</span><span><b>${uses.size}</b> use cases</span>`;
65
+ render();
66
+ }).catch(e=>{$("list").innerHTML=`<p class="empty">Couldn't load notes: ${esc(e)}</p>`});
67
+ ["q","task","sort"].forEach(id=>$(id).addEventListener("input",render));
68
+ </script></body></html>
style.css CHANGED
@@ -1,28 +1,31 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
- }
5
-
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
- }
10
-
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
- }
17
-
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
- }
25
-
26
- .card p:last-child {
27
- margin-bottom: 0;
28
- }
 
 
 
 
1
+ :root{--bg:#f7f7f4;--card:#fff;--ink:#1d2327;--muted:#5d676e;--line:#dfe2dd;--accent:#0b6e69;--soft:#e3f1ef;--gate:#8a5a00;--gatebg:#fbf0d9}
2
+ *{box-sizing:border-box}
3
+ body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif}
4
+ main{max-width:1080px;margin:0 auto;padding:32px 20px 56px}
5
+ a{color:var(--accent)}
6
+ h1{font-size:2rem;line-height:1.2;margin:0 0 8px}
7
+ h2{font-size:1.15rem;margin:32px 0 12px}
8
+ .lede{color:var(--muted);max-width:72ch;margin:0 0 14px}
9
+ nav.links{display:flex;flex-wrap:wrap;gap:8px 18px;margin:0 0 20px;font-size:.95rem}
10
+ nav.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);margin:0 0 22px}
11
+ nav.tabs a{padding:8px 14px;text-decoration:none;color:var(--muted);border-bottom:3px solid transparent}
12
+ nav.tabs a[aria-current]{color:var(--ink);border-color:var(--accent);font-weight:600}
13
+ .stats{display:flex;flex-wrap:wrap;gap:10px 28px;margin:0 0 20px;color:var(--muted);font-size:.95rem}
14
+ .stats b{color:var(--ink);font-size:1.15rem}
15
+ .controls{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-bottom:6px}
16
+ input[type=search]{flex:1 1 240px;padding:9px 12px;border:1px solid var(--line);border-radius:6px;font:inherit;background:#fff}
17
+ select{padding:9px 10px;border:1px solid var(--line);border-radius:6px;font:inherit;background:#fff}
18
+ .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(310px,1fr));gap:14px}
19
+ .card{background:var(--card);border:1px solid var(--line);border-radius:8px;padding:14px 16px;display:flex;flex-direction:column;gap:8px}
20
+ .card.master{grid-column:1/-1;border-color:var(--accent);border-width:2px}
21
+ .who{display:flex;align-items:center;gap:8px;font-size:.82rem;color:var(--muted)}
22
+ .who img{width:24px;height:24px;border-radius:5px;object-fit:cover}
23
+ .card h3{margin:0;font-size:1.05rem;line-height:1.3}
24
+ .card h3 a{text-decoration:none;color:var(--ink)}
25
+ .card h3 a:hover{color:var(--accent);text-decoration:underline}
26
+ .card p{margin:0;color:var(--muted);font-size:.93rem}
27
+ .meta{display:flex;flex-wrap:wrap;gap:6px 12px;font-size:.84rem;color:var(--muted);margin-top:auto;align-items:center}
28
+ .badge{background:var(--gatebg);color:var(--gate);padding:1px 7px;border-radius:4px}
29
+ .empty{color:var(--muted);padding:24px 0}
30
+ footer{margin-top:40px;padding-top:14px;border-top:1px solid var(--line);color:var(--muted);font-size:.86rem}
31
+ @media(max-width:520px){h1{font-size:1.6rem}main{padding:22px 14px 40px}}