fastgpu commited on
Commit
af2a9a4
·
verified ·
1 Parent(s): e1734c3

Quick picks: today's trending models, labelled

Browse files
Files changed (3) hide show
  1. app.js +7 -3
  2. index.html +1 -1
  3. style.css +2 -1
app.js CHANGED
@@ -424,9 +424,13 @@
424
  });
425
  el.input.addEventListener("blur", function () { setTimeout(closeSuggestions, 120); });
426
 
427
- el.picks.innerHTML = PICKS.filter(function (id) { return BY_ID.has(id.toLowerCase()); }).map(function (id) {
428
- return '<button type="button" class="chip" data-id="' + esc(id) + '">' + esc(id.split("/").pop()) + "</button>";
429
- }).join("");
 
 
 
 
430
  el.picks.addEventListener("click", function (e) {
431
  const b = e.target.closest("button[data-id]");
432
  if (!b) return;
 
424
  });
425
  el.input.addEventListener("blur", function () { setTimeout(closeSuggestions, 120); });
426
 
427
+ // The picks are the day's trending models on the Hub (the same models whose pages link this Space), so a visitor
428
+ // who came from one of those pages usually finds it here in one click. window.FASTGPU_PICKS_LABEL names them.
429
+ const shownPicks = PICKS.filter(function (id) { return BY_ID.has(id.toLowerCase()); });
430
+ el.picks.innerHTML = (shownPicks.length && window.FASTGPU_PICKS_LABEL ? '<span class="picks-label">' + esc(window.FASTGPU_PICKS_LABEL) + "</span>" : "") +
431
+ shownPicks.map(function (id) {
432
+ return '<button type="button" class="chip" data-id="' + esc(id) + '">' + esc(id.split("/").pop()) + "</button>";
433
+ }).join("");
434
  el.picks.addEventListener("click", function (e) {
435
  const b = e.target.closest("button[data-id]");
436
  if (!b) return;
index.html CHANGED
@@ -29,7 +29,7 @@
29
  <input id="model" name="model" type="text" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-controls="suggestions" spellcheck="false" placeholder="Search models, paste org/name or a model page link, or type a size like 70B…">
30
  <ul id="suggestions" role="listbox" aria-label="Models" hidden></ul>
31
  </div>
32
- <div id="picks" class="picks" aria-label="Popular models"></div>
33
 
34
  <div class="opts">
35
  <label>Job
 
29
  <input id="model" name="model" type="text" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-controls="suggestions" spellcheck="false" placeholder="Search models, paste org/name or a model page link, or type a size like 70B…">
30
  <ul id="suggestions" role="listbox" aria-label="Models" hidden></ul>
31
  </div>
32
+ <div id="picks" class="picks" aria-label="Trending models"></div>
33
 
34
  <div class="opts">
35
  <label>Job
style.css CHANGED
@@ -93,7 +93,8 @@ h1 {
93
  .opt-name { font-weight: 500; overflow-wrap: anywhere; }
94
  .opt-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
95
 
96
- .picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
 
97
  .chip {
98
  font: 500 12.5px/1 "Instrument Sans", system-ui, sans-serif;
99
  color: var(--ink); background: transparent;
 
93
  .opt-name { font-weight: 500; overflow-wrap: anywhere; }
94
  .opt-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
95
 
96
+ .picks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
97
+ .picks-label { color: var(--muted); font-size: 12.5px; margin-right: 2px; }
98
  .chip {
99
  font: 500 12.5px/1 "Instrument Sans", system-ui, sans-serif;
100
  color: var(--ink); background: transparent;