blackboxanalytics commited on
Commit
14a1280
ยท
verified ยท
1 Parent(s): a4c66c6

Longer spin + accurate pool-count explainer

Browse files
Files changed (1) hide show
  1. app.py +20 -15
app.py CHANGED
@@ -239,26 +239,31 @@ def _why_note() -> str:
239
  pool = _STATS.get("pool", 0)
240
  infra = _STATS.get("infra", 0)
241
  priv = _STATS.get("private", 0)
242
- # `listed` is the total the app actually enumerated โ€” i.e. exactly what the
243
- # org's Spaces page shows the same viewer (946 with a token that can see the
244
- # private spaces, 886 to an anonymous visitor). Compare against that so the
245
- # number matches what the user sees on the Hub.
246
  listed = _STATS.get("listed", 0) or (pool + infra + priv)
247
  if not listed:
248
  return ""
249
- parts = []
 
 
250
  if priv:
251
- parts.append(f"<strong>{priv}</strong> are private or test spaces "
252
- f"(hidden from the public listing, with dead links)")
253
- if infra:
254
- parts.append(f"<strong>{infra}</strong> are org info pages "
255
- f"(<em>field-guide</em> &amp; <em>README</em>), not competition entries")
256
- breakdown = f" โ€” {'; '.join(parts)}," if parts else ""
 
 
 
 
 
 
 
 
257
  return f"""
258
  <div class="why-line">
259
- <span class="why-chip" tabindex="0">โ“˜ why {pool}, not {listed}?
260
- <span class="why-pop">The org page lists <strong>{listed}</strong> Spaces{breakdown}
261
- leaving <strong>{pool}</strong> real, public submissions to spin through.</span>
262
  </span>
263
  </div>"""
264
 
@@ -598,7 +603,7 @@ HEAD_HTML = r"""<script>
598
  if (!raf) loop();
599
  };
600
 
601
- const MIN_SPIN = 650; // keep the wheel visibly spinning even when the draw is instant
602
  const REEL = '<div class="reel-wrap"><div class="reel"><div class="reel-strip">๐ŸŽฎ ๐ŸŽจ ๐ŸŽ™๏ธ ๐Ÿฉบ ๐Ÿ’ผ ๐ŸŽ“ โš™๏ธ ๐ŸŒ ๐Ÿ’ฌ ๐Ÿ›ก๏ธ ๐Ÿ“ธ ๐Ÿ’š ๐ŸŽฎ ๐ŸŽจ ๐ŸŽ™๏ธ ๐Ÿฉบ<\/div><\/div><p class="reel-txt">spinning the wheelโ€ฆ<\/p><\/div>';
603
  // The reel is an OVERLAY on top of #card-out โ€” never the card's own DOM. Two
604
  // bugs this fixes: (1) mutating Gradio's Svelte-managed card node broke every
 
239
  pool = _STATS.get("pool", 0)
240
  infra = _STATS.get("infra", 0)
241
  priv = _STATS.get("private", 0)
 
 
 
 
242
  listed = _STATS.get("listed", 0) or (pool + infra + priv)
243
  if not listed:
244
  return ""
245
+ pub = listed - priv # public Spaces โ€” the count the org page shows visitors
246
+ info = (f"<strong>{infra}</strong> org info page" + ("s" if infra != 1 else "")
247
+ + " (<em>field-guide</em> &amp; <em>README</em>)")
248
  if priv:
249
+ # Authenticated: we can actually see and count the private/test spaces, so
250
+ # reconcile every number โ€” total, private, the public page count, infra.
251
+ head = f"โ“˜ why {pool}, not {listed}?"
252
+ body = (f"The org has <strong>{listed}</strong> Spaces in total. "
253
+ f"<strong>{priv}</strong> are private or test spaces (so the public page "
254
+ f"shows <strong>{pub}</strong>), and {info} aren't competition entries โ€” "
255
+ f"leaving <strong>{pool}</strong> real, public submissions to spin through.")
256
+ else:
257
+ # Anonymous: the Hub API won't reveal the private spaces, so don't claim a
258
+ # total that would contradict the higher number on the org page.
259
+ head = f"โ“˜ {pool} public submissions"
260
+ body = (f"Every public project the Hub's API serves, minus {info}. Private and "
261
+ f"test Spaces โ€” plus a handful the org page counts that the public API "
262
+ f"doesn't return โ€” aren't included.")
263
  return f"""
264
  <div class="why-line">
265
+ <span class="why-chip" tabindex="0">{head}
266
+ <span class="why-pop">{body}</span>
 
267
  </span>
268
  </div>"""
269
 
 
603
  if (!raf) loop();
604
  };
605
 
606
+ const MIN_SPIN = 1100; // keep the wheel visibly spinning even when the draw is instant
607
  const REEL = '<div class="reel-wrap"><div class="reel"><div class="reel-strip">๐ŸŽฎ ๐ŸŽจ ๐ŸŽ™๏ธ ๐Ÿฉบ ๐Ÿ’ผ ๐ŸŽ“ โš™๏ธ ๐ŸŒ ๐Ÿ’ฌ ๐Ÿ›ก๏ธ ๐Ÿ“ธ ๐Ÿ’š ๐ŸŽฎ ๐ŸŽจ ๐ŸŽ™๏ธ ๐Ÿฉบ<\/div><\/div><p class="reel-txt">spinning the wheelโ€ฆ<\/p><\/div>';
608
  // The reel is an OVERLAY on top of #card-out โ€” never the card's own DOM. Two
609
  // bugs this fixes: (1) mutating Gradio's Svelte-managed card node broke every