Spaces:
Running
Running
Upload webapp/app.py with huggingface_hub
Browse files- webapp/app.py +80 -9
webapp/app.py
CHANGED
|
@@ -87,6 +87,19 @@ padding:6px 12px;font-size:13px;color:var(--ink)}
|
|
| 87 |
.chip:hover{border-color:var(--acc);color:var(--acc)}
|
| 88 |
ul.explain{margin:8px 0 0;padding-left:20px}ul.explain li{margin:6px 0;color:var(--mut)}
|
| 89 |
ul.explain b{color:var(--ink)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
"""
|
| 91 |
|
| 92 |
# Real wallets that showcase the product's judgement β one to follow, one too big
|
|
@@ -117,9 +130,10 @@ just made.</p></div>
|
|
| 117 |
<div class=card><h3 style="margin:0 0 8px">What am I looking at?</h3>
|
| 118 |
<ul class=explain>
|
| 119 |
<li><b>Top moves right now</b> β the highest-signal bets our tracked traders placed
|
| 120 |
-
recently. <b>Signal
|
| 121 |
-
|
| 122 |
-
|
|
|
|
| 123 |
<li><b>The traders we're tracking</b> β the vetted wallets themselves. These are
|
| 124 |
<b>mid-size traders whale trackers skip</b> (not $10k+ whales, not market-makers),
|
| 125 |
scored on consistency, repeatability and copyability β <i>not</i> size. Tap any
|
|
@@ -129,10 +143,34 @@ address to verify it live on Polymarket.</li>
|
|
| 129 |
"""
|
| 130 |
|
| 131 |
|
| 132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
return f"""<!doctype html><html lang=en><head><meta charset=utf-8>
|
| 134 |
<meta name=viewport content="width=device-width,initial-scale=1">
|
| 135 |
-
<title>{escape(title)}</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
<style>{CSS}</style></head><body><div class=wrap>
|
| 137 |
<div class=nav><a class=brand href="/"><span>β</span> {BRAND}</a>
|
| 138 |
<div class=navlinks><a href="/">Score a wallet</a><a href="/digest">Daily digest</a></div></div>
|
|
@@ -142,6 +180,22 @@ advice.</b> Consistency scoring β guaranteed profit. Past performance is not p
|
|
| 142 |
</div></body></html>"""
|
| 143 |
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
def scorer_form(prefill: str = "") -> str:
|
| 146 |
return f"""<form action="/score" method=get class=row>
|
| 147 |
<input type=text name=wallet placeholder="Paste a Polymarket wallet: 0xβ¦"
|
|
@@ -169,7 +223,13 @@ moves, once a day. Free tier delayed 24h.</p>
|
|
| 169 |
<input type=email name=email placeholder="you@email.com" required>
|
| 170 |
<button type=submit>Subscribe free</button></form></div>
|
| 171 |
"""
|
| 172 |
-
return page(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
|
| 175 |
@app.route("/score")
|
|
@@ -207,7 +267,13 @@ try a real trader below.</p></div>
|
|
| 207 |
<div class=card style="margin-top:18px"><b>Score another</b>{scorer_form()}</div>
|
| 208 |
<p class="mut small">{escape(r.note)}</p>
|
| 209 |
"""
|
| 210 |
-
return page(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
|
| 212 |
|
| 213 |
_TABLE_RE = re.compile(r"^\|(.+)\|\s*$")
|
|
@@ -251,7 +317,7 @@ def _md_to_html(md: str) -> str:
|
|
| 251 |
head = cells[0]
|
| 252 |
h = "".join(f"<th>{_inline(c)}</th>" for c in head)
|
| 253 |
b = "".join("<tr>" + "".join(f"<td>{_inline(c)}</td>" for c in r) + "</tr>" for r in body)
|
| 254 |
-
out.append(f"<table><thead><tr>{h}</tr></thead><tbody>{b}</tbody></table>")
|
| 255 |
rows.clear()
|
| 256 |
|
| 257 |
for ln in md.splitlines():
|
|
@@ -290,7 +356,12 @@ def digest():
|
|
| 290 |
f"<form action='/subscribe' method=post class=row style='margin-top:10px'>" \
|
| 291 |
f"<input type=email name=email placeholder='you@email.com' required>" \
|
| 292 |
f"<button type=submit>Subscribe free</button></form></div>"
|
| 293 |
-
return page(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
|
| 295 |
|
| 296 |
SUBSCRIBERS_DATASET = "sharpflowapp/subscribers"
|
|
|
|
| 87 |
.chip:hover{border-color:var(--acc);color:var(--acc)}
|
| 88 |
ul.explain{margin:8px 0 0;padding-left:20px}ul.explain li{margin:6px 0;color:var(--mut)}
|
| 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}
|
| 95 |
+
.card{padding:16px}
|
| 96 |
+
.grid{grid-template-columns:1fr 1fr}
|
| 97 |
+
.navlinks{gap:14px}.navlinks a{font-size:13px}
|
| 98 |
+
.brand{font-size:19px}
|
| 99 |
+
button{width:100%}.row>*{min-width:100%}
|
| 100 |
+
table{font-size:13px}th,td{padding:7px 5px}
|
| 101 |
+
}
|
| 102 |
+
@media (max-width:380px){.grid{grid-template-columns:1fr}}
|
| 103 |
"""
|
| 104 |
|
| 105 |
# Real wallets that showcase the product's judgement β one to follow, one too big
|
|
|
|
| 130 |
<div class=card><h3 style="margin:0 0 8px">What am I looking at?</h3>
|
| 131 |
<ul class=explain>
|
| 132 |
<li><b>Top moves right now</b> β the highest-signal bets our tracked traders placed
|
| 133 |
+
recently. <b>Signal</b> blends the trader's track record with how big this bet is
|
| 134 |
+
<i>for them</i> (conviction) and how far the price is from a coin-flip (edge). The
|
| 135 |
+
dots are a <b>relative rank of today's moves</b> β βββββ = strongest in the list,
|
| 136 |
+
βββββ = weakest.</li>
|
| 137 |
<li><b>The traders we're tracking</b> β the vetted wallets themselves. These are
|
| 138 |
<b>mid-size traders whale trackers skip</b> (not $10k+ whales, not market-makers),
|
| 139 |
scored on consistency, repeatability and copyability β <i>not</i> size. Tap any
|
|
|
|
| 143 |
"""
|
| 144 |
|
| 145 |
|
| 146 |
+
SITE_URL = "https://sharpflowapp-web.hf.space"
|
| 147 |
+
JSONLD = (
|
| 148 |
+
'{"@context":"https://schema.org","@type":"WebApplication",'
|
| 149 |
+
'"name":"SharpFlow","applicationCategory":"FinanceApplication",'
|
| 150 |
+
'"operatingSystem":"Web","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"},'
|
| 151 |
+
'"description":"Score any Polymarket wallet and follow consistent mid-size smart-money '
|
| 152 |
+
'traders that whale trackers miss.","url":"' + SITE_URL + '"}'
|
| 153 |
+
)
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def page(title: str, body: str, desc: str = "", path: str = "/") -> str:
|
| 157 |
+
desc = desc or TAGLINE
|
| 158 |
+
canon = SITE_URL + path
|
| 159 |
return f"""<!doctype html><html lang=en><head><meta charset=utf-8>
|
| 160 |
<meta name=viewport content="width=device-width,initial-scale=1">
|
| 161 |
+
<title>{escape(title)}</title>
|
| 162 |
+
<meta name=description content="{escape(desc)}">
|
| 163 |
+
<link rel=canonical href="{escape(canon, quote=True)}">
|
| 164 |
+
<meta name=robots content="index,follow">
|
| 165 |
+
<meta property="og:type" content="website">
|
| 166 |
+
<meta property="og:site_name" content="{BRAND}">
|
| 167 |
+
<meta property="og:title" content="{escape(title)}">
|
| 168 |
+
<meta property="og:description" content="{escape(desc)}">
|
| 169 |
+
<meta property="og:url" content="{escape(canon, quote=True)}">
|
| 170 |
+
<meta name="twitter:card" content="summary_large_image">
|
| 171 |
+
<meta name="twitter:title" content="{escape(title)}">
|
| 172 |
+
<meta name="twitter:description" content="{escape(desc)}">
|
| 173 |
+
<script type="application/ld+json">{JSONLD}</script>
|
| 174 |
<style>{CSS}</style></head><body><div class=wrap>
|
| 175 |
<div class=nav><a class=brand href="/"><span>β</span> {BRAND}</a>
|
| 176 |
<div class=navlinks><a href="/">Score a wallet</a><a href="/digest">Daily digest</a></div></div>
|
|
|
|
| 180 |
</div></body></html>"""
|
| 181 |
|
| 182 |
|
| 183 |
+
@app.route("/robots.txt")
|
| 184 |
+
def robots():
|
| 185 |
+
return (f"User-agent: *\nAllow: /\nSitemap: {SITE_URL}/sitemap.xml\n",
|
| 186 |
+
200, {"Content-Type": "text/plain"})
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
@app.route("/sitemap.xml")
|
| 190 |
+
def sitemap():
|
| 191 |
+
urls = ["/", "/digest"]
|
| 192 |
+
items = "".join(f"<url><loc>{SITE_URL}{u}</loc></url>" for u in urls)
|
| 193 |
+
xml = ('<?xml version="1.0" encoding="UTF-8"?>'
|
| 194 |
+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
|
| 195 |
+
f"{items}</urlset>")
|
| 196 |
+
return xml, 200, {"Content-Type": "application/xml"}
|
| 197 |
+
|
| 198 |
+
|
| 199 |
def scorer_form(prefill: str = "") -> str:
|
| 200 |
return f"""<form action="/score" method=get class=row>
|
| 201 |
<input type=text name=wallet placeholder="Paste a Polymarket wallet: 0xβ¦"
|
|
|
|
| 223 |
<input type=email name=email placeholder="you@email.com" required>
|
| 224 |
<button type=submit>Subscribe free</button></form></div>
|
| 225 |
"""
|
| 226 |
+
return page(
|
| 227 |
+
f"{BRAND} β Polymarket smart-money tracker & free wallet score",
|
| 228 |
+
body,
|
| 229 |
+
desc="Score any Polymarket wallet free, and follow consistent mid-size "
|
| 230 |
+
"smart-money traders that whale trackers miss. Flow intelligence, not "
|
| 231 |
+
"financial advice.",
|
| 232 |
+
path="/")
|
| 233 |
|
| 234 |
|
| 235 |
@app.route("/score")
|
|
|
|
| 267 |
<div class=card style="margin-top:18px"><b>Score another</b>{scorer_form()}</div>
|
| 268 |
<p class="mut small">{escape(r.note)}</p>
|
| 269 |
"""
|
| 270 |
+
return page(
|
| 271 |
+
f"{short} Polymarket wallet score {r.trader_score:.2f} β {BRAND}",
|
| 272 |
+
body,
|
| 273 |
+
desc=f"Polymarket wallet {short} scored {r.trader_score:.2f}: "
|
| 274 |
+
f"{TAGLABEL.get(tag, tag).lower()}. Consistency, repeatability and "
|
| 275 |
+
f"copyability β not size.",
|
| 276 |
+
path="/score")
|
| 277 |
|
| 278 |
|
| 279 |
_TABLE_RE = re.compile(r"^\|(.+)\|\s*$")
|
|
|
|
| 317 |
head = cells[0]
|
| 318 |
h = "".join(f"<th>{_inline(c)}</th>" for c in head)
|
| 319 |
b = "".join("<tr>" + "".join(f"<td>{_inline(c)}</td>" for c in r) + "</tr>" for r in body)
|
| 320 |
+
out.append(f"<div class=tscroll><table><thead><tr>{h}</tr></thead><tbody>{b}</tbody></table></div>")
|
| 321 |
rows.clear()
|
| 322 |
|
| 323 |
for ln in md.splitlines():
|
|
|
|
| 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>" \
|
| 358 |
f"<button type=submit>Subscribe free</button></form></div>"
|
| 359 |
+
return page(
|
| 360 |
+
f"{BRAND} β Daily Polymarket smart-money digest",
|
| 361 |
+
body,
|
| 362 |
+
desc="The consistent mid-size Polymarket traders whale trackers skip, and "
|
| 363 |
+
"their highest-conviction moves today β each scored for signal quality.",
|
| 364 |
+
path="/digest")
|
| 365 |
|
| 366 |
|
| 367 |
SUBSCRIBERS_DATASET = "sharpflowapp/subscribers"
|