Longer spin + accurate pool-count explainer
Browse files
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 |
-
|
|
|
|
|
|
|
| 250 |
if priv:
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
return f"""
|
| 258 |
<div class="why-line">
|
| 259 |
-
<span class="why-chip" tabindex="0">
|
| 260 |
-
<span class="why-pop">
|
| 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 =
|
| 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> & <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
|