Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -191,8 +191,12 @@ def _render_leaderboard() -> str:
|
|
| 191 |
best = sorted_asc[:15]
|
| 192 |
worst = sorted_desc[:15]
|
| 193 |
|
| 194 |
-
def entry_html(e, rank):
|
| 195 |
-
pct
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
color = "#C0392B" if pct >= 70 else "#E67E22" if pct >= 40 else "#27AE60"
|
| 197 |
medal = ["🥇","🥈","🥉"] [rank] if rank < 3 else f"{rank+1}."
|
| 198 |
full = e["text"].replace("<", "<").replace(">", ">")
|
|
@@ -223,8 +227,8 @@ def _render_leaderboard() -> str:
|
|
| 223 |
<div style="font-size:.75rem;color:#888;font-style:italic;">"{e.get('verdict','')}"</div>
|
| 224 |
</div>"""
|
| 225 |
|
| 226 |
-
best_html = "".join(entry_html(e, i
|
| 227 |
-
worst_html = "".join(entry_html(e, i) for i, e in enumerate(worst))
|
| 228 |
|
| 229 |
total_count = len(entries)
|
| 230 |
avg_pct = round(sum(e["pct"] for e in entries) / total_count)
|
|
@@ -248,16 +252,16 @@ def _render_leaderboard() -> str:
|
|
| 248 |
<span style="font-size:.78rem;color:#888;">
|
| 249 |
{total_count} Einträge · Ø {avg_pct}% Nonsense
|
| 250 |
</span>
|
| 251 |
-
<div style="margin-left:auto; display:flex; align-items:
|
|
|
|
| 252 |
<button onclick="document.getElementById('hidden_sync_btn').click()"
|
| 253 |
style="background:transparent; border:1px solid #E0DFDC; color:#666;
|
| 254 |
font-size:.75rem; font-weight:600; padding:3px 10px; border-radius:99px;
|
| 255 |
-
cursor:pointer;
|
| 256 |
-
onmouseover="this.style.background='#EBF3FB'; this.style.color='#0A66C2';
|
| 257 |
-
onmouseout="this.style.background='transparent'; this.style.color='#666';
|
| 258 |
🔄 Aktualisieren
|
| 259 |
</button>
|
| 260 |
-
{dataset_badge}
|
| 261 |
</div>
|
| 262 |
</div>
|
| 263 |
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:20px;">
|
|
|
|
| 191 |
best = sorted_asc[:15]
|
| 192 |
worst = sorted_desc[:15]
|
| 193 |
|
| 194 |
+
def entry_html(e, rank, side="worst"):
|
| 195 |
+
pct = e["pct"]
|
| 196 |
+
if side == "best":
|
| 197 |
+
color = "#1A5C34" if pct < 40 else "#27AE60" if pct < 70 else "#E67E22"
|
| 198 |
+
else:
|
| 199 |
+
color = "#C0392B" if pct >= 70 else "#E67E22" if pct >= 40 else "#27AE60"
|
| 200 |
color = "#C0392B" if pct >= 70 else "#E67E22" if pct >= 40 else "#27AE60"
|
| 201 |
medal = ["🥇","🥈","🥉"] [rank] if rank < 3 else f"{rank+1}."
|
| 202 |
full = e["text"].replace("<", "<").replace(">", ">")
|
|
|
|
| 227 |
<div style="font-size:.75rem;color:#888;font-style:italic;">"{e.get('verdict','')}"</div>
|
| 228 |
</div>"""
|
| 229 |
|
| 230 |
+
best_html = "".join(entry_html(e, i, side="best") for i, e in enumerate(best))
|
| 231 |
+
worst_html = "".join(entry_html(e, i, side="worst") for i, e in enumerate(worst))
|
| 232 |
|
| 233 |
total_count = len(entries)
|
| 234 |
avg_pct = round(sum(e["pct"] for e in entries) / total_count)
|
|
|
|
| 252 |
<span style="font-size:.78rem;color:#888;">
|
| 253 |
{total_count} Einträge · Ø {avg_pct}% Nonsense
|
| 254 |
</span>
|
| 255 |
+
<div style="margin-left:auto; display:flex; flex-direction:column; align-items:flex-end; gap:4px;">
|
| 256 |
+
{dataset_badge}
|
| 257 |
<button onclick="document.getElementById('hidden_sync_btn').click()"
|
| 258 |
style="background:transparent; border:1px solid #E0DFDC; color:#666;
|
| 259 |
font-size:.75rem; font-weight:600; padding:3px 10px; border-radius:99px;
|
| 260 |
+
cursor:pointer;"
|
| 261 |
+
onmouseover="this.style.background='#EBF3FB'; this.style.color='#0A66C2';"
|
| 262 |
+
onmouseout="this.style.background='transparent'; this.style.color='#666';">
|
| 263 |
🔄 Aktualisieren
|
| 264 |
</button>
|
|
|
|
| 265 |
</div>
|
| 266 |
</div>
|
| 267 |
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:20px;">
|