Spaces:
Running
Running
Upload webapp/app.py with huggingface_hub
Browse files- webapp/app.py +17 -7
webapp/app.py
CHANGED
|
@@ -38,7 +38,7 @@ BRAND = "SharpFlow"
|
|
| 38 |
TAGLINE = "The Polymarket smart-money tracker whale trackers miss."
|
| 39 |
|
| 40 |
CSS = """
|
| 41 |
-
:root{--bg:#0a0f14;--card:#111820;--ink:#e6edf3;--mut:#7d8da0;--acc:#22d3ee;
|
| 42 |
--acc2:#14b8a6;--warn:#d29922;--bad:#f85149;--line:#1c2531;--inset:#0c131b}
|
| 43 |
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);
|
| 44 |
font:16px/1.55 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
|
|
@@ -85,10 +85,14 @@ padding-bottom:12px;border-bottom:1px solid var(--line)}
|
|
| 85 |
.chip{border:1px solid var(--line);background:var(--inset);border-radius:999px;
|
| 86 |
padding:6px 12px;font-size:13px;color:var(--ink)}
|
| 87 |
.chip:hover{border-color:var(--acc);color:var(--acc)}
|
| 88 |
-
ul.explain{margin:
|
| 89 |
-
ul.explain b{color:var(--ink)}
|
| 90 |
.tscroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
|
| 91 |
.tscroll table{min-width:520px}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
@media (max-width:640px){
|
| 93 |
.wrap{padding:20px 14px}
|
| 94 |
.hero h1{font-size:26px}.hero p{font-size:16px}
|
|
@@ -304,9 +308,11 @@ def _bold(text: str) -> str:
|
|
| 304 |
return "".join(parts)
|
| 305 |
|
| 306 |
|
| 307 |
-
def _md_to_html(md: str) -> str:
|
| 308 |
"""Tiny markdown renderer: headings, tables, hr, paragraphs. Enough for our
|
| 309 |
-
own digest output — not a general parser.
|
|
|
|
|
|
|
| 310 |
out, rows = [], []
|
| 311 |
|
| 312 |
def flush_table():
|
|
@@ -328,6 +334,9 @@ def _md_to_html(md: str) -> str:
|
|
| 328 |
s = ln.strip()
|
| 329 |
if not s:
|
| 330 |
continue
|
|
|
|
|
|
|
|
|
|
| 331 |
if s.startswith("### "):
|
| 332 |
out.append(f"<h3>{escape(s[4:])}</h3>")
|
| 333 |
elif s.startswith("## "):
|
|
@@ -337,7 +346,8 @@ def _md_to_html(md: str) -> str:
|
|
| 337 |
elif s == "---":
|
| 338 |
out.append("<hr style='border:0;border-top:1px solid var(--line)'>")
|
| 339 |
else:
|
| 340 |
-
|
|
|
|
| 341 |
flush_table()
|
| 342 |
return "\n".join(out)
|
| 343 |
|
|
@@ -351,7 +361,7 @@ def digest():
|
|
| 351 |
"<p class=mut>Run <code>python scripts/05_digest.py</code> to generate one.</p></div>")
|
| 352 |
md = files[-1].read_text(encoding="utf-8")
|
| 353 |
body = DIGEST_EXPLAINER \
|
| 354 |
-
+ f"<div class=card>{_md_to_html(md)}</div>" \
|
| 355 |
f"<div class=card><b>Want it daily by email?</b>" \
|
| 356 |
f"<form action='/subscribe' method=post class=row style='margin-top:10px'>" \
|
| 357 |
f"<input type=email name=email placeholder='you@email.com' required>" \
|
|
|
|
| 38 |
TAGLINE = "The Polymarket smart-money tracker whale trackers miss."
|
| 39 |
|
| 40 |
CSS = """
|
| 41 |
+
:root{--bg:#0a0f14;--card:#111820;--ink:#e6edf3;--mut:#7d8da0;--body:#c7d0dc;--acc:#22d3ee;
|
| 42 |
--acc2:#14b8a6;--warn:#d29922;--bad:#f85149;--line:#1c2531;--inset:#0c131b}
|
| 43 |
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);
|
| 44 |
font:16px/1.55 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
|
|
|
|
| 85 |
.chip{border:1px solid var(--line);background:var(--inset);border-radius:999px;
|
| 86 |
padding:6px 12px;font-size:13px;color:var(--ink)}
|
| 87 |
.chip:hover{border-color:var(--acc);color:var(--acc)}
|
| 88 |
+
ul.explain{margin:10px 0 0;padding-left:20px}ul.explain li{margin:10px 0;color:var(--body);
|
| 89 |
+
line-height:1.65;max-width:64ch}ul.explain b{color:var(--ink)}
|
| 90 |
.tscroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
|
| 91 |
.tscroll table{min-width:520px}
|
| 92 |
+
.digest p{color:var(--body);line-height:1.7;max-width:66ch;margin:12px 0}
|
| 93 |
+
.digest h2{font-size:19px;margin:28px 0 6px;letter-spacing:-.01em}
|
| 94 |
+
.digest h2:first-child{margin-top:4px}
|
| 95 |
+
.digest .lead{font-size:15px;color:var(--mut);margin:0 0 6px}
|
| 96 |
@media (max-width:640px){
|
| 97 |
.wrap{padding:20px 14px}
|
| 98 |
.hero h1{font-size:26px}.hero p{font-size:16px}
|
|
|
|
| 308 |
return "".join(parts)
|
| 309 |
|
| 310 |
|
| 311 |
+
def _md_to_html(md: str, terse: bool = False) -> str:
|
| 312 |
"""Tiny markdown renderer: headings, tables, hr, paragraphs. Enough for our
|
| 313 |
+
own digest output — not a general parser. In terse mode we drop the leading
|
| 314 |
+
H1 and the italic-only legend paragraphs (the web page already explains those
|
| 315 |
+
in the explainer card), so the render doesn't repeat itself."""
|
| 316 |
out, rows = [], []
|
| 317 |
|
| 318 |
def flush_table():
|
|
|
|
| 334 |
s = ln.strip()
|
| 335 |
if not s:
|
| 336 |
continue
|
| 337 |
+
italic_only = len(s) > 1 and s.startswith("_") and s.endswith("_")
|
| 338 |
+
if terse and (s.startswith("# ") or s == "---" or italic_only):
|
| 339 |
+
continue
|
| 340 |
if s.startswith("### "):
|
| 341 |
out.append(f"<h3>{escape(s[4:])}</h3>")
|
| 342 |
elif s.startswith("## "):
|
|
|
|
| 346 |
elif s == "---":
|
| 347 |
out.append("<hr style='border:0;border-top:1px solid var(--line)'>")
|
| 348 |
else:
|
| 349 |
+
cls = "lead" if terse else "mut"
|
| 350 |
+
out.append(f"<p class={cls}>{_inline(s.replace('_', ''))}</p>")
|
| 351 |
flush_table()
|
| 352 |
return "\n".join(out)
|
| 353 |
|
|
|
|
| 361 |
"<p class=mut>Run <code>python scripts/05_digest.py</code> to generate one.</p></div>")
|
| 362 |
md = files[-1].read_text(encoding="utf-8")
|
| 363 |
body = DIGEST_EXPLAINER \
|
| 364 |
+
+ f"<div class='card digest'>{_md_to_html(md, terse=True)}</div>" \
|
| 365 |
f"<div class=card><b>Want it daily by email?</b>" \
|
| 366 |
f"<form action='/subscribe' method=post class=row style='margin-top:10px'>" \
|
| 367 |
f"<input type=email name=email placeholder='you@email.com' required>" \
|