umer-wasim commited on
Commit
34dca0a
·
verified ·
1 Parent(s): 1806095

Add live download stats section

Browse files

Downloads section under the hero stats: app installers, AI model (all formats), vulnerability data and training data, read from the Hugging Face API on every page load.

Files changed (3) hide show
  1. index.html +10 -0
  2. site/site.css +2 -0
  3. site/site.js +29 -1
index.html CHANGED
@@ -72,6 +72,16 @@
72
  </div>
73
  </section>
74
 
 
 
 
 
 
 
 
 
 
 
75
  <section class="wrap section" id="checks">
76
  <div class="section-head"><h2>High-risk checks</h2><a class="tiny muted link" href="#all-checks">See all <span data-count>70</span> →</a></div>
77
  <div class="rail" id="riskRail"></div>
 
72
  </div>
73
  </section>
74
 
75
+ <section class="wrap section" id="downloads">
76
+ <div class="section-head"><h2>Downloads</h2><span class="tiny muted" id="dlStatsNote">Downloads in the last 30 days · from Hugging Face</span></div>
77
+ <div class="stats">
78
+ <a class="stat c-red" href="https://huggingface.co/datasets/Devseis/endpoint-auditor-releases"><span class="tiny muted">App installers</span><b data-dl="installers">–</b><span class="tiny muted">Mac, Windows &amp; Linux</span></a>
79
+ <a class="stat c-blue" href="https://huggingface.co/Devseis/endpoint-auditor-0.5b"><span class="tiny muted">AI model</span><b data-dl="model">–</b><span class="tiny muted">endpoint-auditor-0.5b, all formats</span></a>
80
+ <a class="stat c-green" href="https://huggingface.co/datasets/Devseis/endpoint-auditor-vulndb"><span class="tiny muted">Vulnerability data</span><b data-dl="vulndb">–</b><span class="tiny muted">known-vulnerability database</span></a>
81
+ <a class="stat c-violet" href="https://huggingface.co/datasets/Devseis/endpoint-auditor-synthetic"><span class="tiny muted">Training data</span><b data-dl="training">–</b><span class="tiny muted">synthetic audits</span></a>
82
+ </div>
83
+ </section>
84
+
85
  <section class="wrap section" id="checks">
86
  <div class="section-head"><h2>High-risk checks</h2><a class="tiny muted link" href="#all-checks">See all <span data-count>70</span> →</a></div>
87
  <div class="rail" id="riskRail"></div>
site/site.css CHANGED
@@ -79,6 +79,8 @@ p { margin: 0; }
79
  /* stats (metric grid) */
80
  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
81
  .stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; }
 
 
82
  .stat b { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
83
 
84
  /* sections */
 
79
  /* stats (metric grid) */
80
  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
81
  .stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; }
82
+ a.stat { color: inherit; text-decoration: none; transition: border-color .15s; }
83
+ a.stat:hover { border-color: var(--c, var(--fg)); }
84
  .stat b { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
85
 
86
  /* sections */
site/site.js CHANGED
@@ -105,6 +105,34 @@ async function initDownloads() {
105
  } catch { /* keep the version written in the page */ }
106
  }
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  // ---------- checks ----------
109
  async function loadLibrary() {
110
  const get = async path => { const r = await fetch(path); if (!r.ok) throw new Error(`${path}: HTTP ${r.status}`); return r.json(); };
@@ -244,7 +272,7 @@ function handedOverReport() {
244
  }
245
 
246
  async function init() {
247
- initDevice(); initDownloads();
248
  try { await loadLibrary(); } catch (e) { $('checkCount').textContent = 'Could not load the check list.'; console.warn(e); return; }
249
  document.querySelectorAll('[data-count]').forEach(el => { el.textContent = state.checks.length; });
250
  renderRail(); renderFilters(); renderTable();
 
105
  } catch { /* keep the version written in the page */ }
106
  }
107
 
108
+ // ---------- download stats: read live from the Hugging Face API on every page load ----------
109
+ // The API counts downloads over the last 30 days. The AI model total adds up the base model and its three MLC builds.
110
+ const DL_GROUPS = {
111
+ installers: ['datasets', 'Devseis/endpoint-auditor-releases'],
112
+ model: ['models', /^Devseis\/endpoint-auditor-0\.5b(-.*-MLC)?$/],
113
+ vulndb: ['datasets', 'Devseis/endpoint-auditor-vulndb'],
114
+ training: ['datasets', 'Devseis/endpoint-auditor-synthetic'],
115
+ };
116
+ async function initDownloadStats() {
117
+ const note = $('dlStatsNote');
118
+ try {
119
+ const list = async kind => {
120
+ const r = await fetch(`https://huggingface.co/api/${kind}?author=Devseis&limit=100&expand[]=downloads`, { cache: 'no-store' });
121
+ if (!r.ok) throw new Error(`${kind}: HTTP ${r.status}`);
122
+ return r.json();
123
+ };
124
+ const repos = { models: await list('models'), datasets: await list('datasets') };
125
+ for (const [key, [kind, match]] of Object.entries(DL_GROUPS)) {
126
+ const total = repos[kind].filter(r => (typeof match === 'string' ? r.id === match : match.test(r.id))).reduce((n, r) => n + (r.downloads || 0), 0);
127
+ document.querySelector(`[data-dl="${key}"]`).textContent = total.toLocaleString('en-GB');
128
+ }
129
+ note.textContent = `Downloads in the last 30 days · ${new Date().toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' })}`;
130
+ } catch (e) {
131
+ note.textContent = 'Download counts could not be loaded from Hugging Face.';
132
+ console.warn(e);
133
+ }
134
+ }
135
+
136
  // ---------- checks ----------
137
  async function loadLibrary() {
138
  const get = async path => { const r = await fetch(path); if (!r.ok) throw new Error(`${path}: HTTP ${r.status}`); return r.json(); };
 
272
  }
273
 
274
  async function init() {
275
+ initDevice(); initDownloads(); initDownloadStats();
276
  try { await loadLibrary(); } catch (e) { $('checkCount').textContent = 'Could not load the check list.'; console.warn(e); return; }
277
  document.querySelectorAll('[data-count]').forEach(el => { el.textContent = state.checks.length; });
278
  renderRail(); renderFilters(); renderTable();