Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -396,17 +396,32 @@ def get_user_greeting(profile: gr.OAuthProfile | None):
|
|
| 396 |
# BUILD UI
|
| 397 |
# =========================
|
| 398 |
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
|
| 411 |
EVAL_DETAILS_MD = """
|
| 412 |
### How is the Score Calculated?
|
|
@@ -441,19 +456,126 @@ Your JSON file must be a **list of annotation objects**, each containing:
|
|
| 441 |
```
|
| 442 |
"""
|
| 443 |
|
| 444 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 445 |
|
| 446 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
|
|
|
|
| 448 |
with gr.Row():
|
| 449 |
-
with gr.Column(scale=
|
| 450 |
-
gr.Markdown(
|
| 451 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 452 |
login_btn = gr.LoginButton(size="lg")
|
| 453 |
-
user_greeting = gr.Markdown("👋 Log in
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 454 |
|
| 455 |
gr.Markdown("---")
|
| 456 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 457 |
with gr.Tabs():
|
| 458 |
|
| 459 |
# ── LEADERBOARD TAB ──────────────────────────────────────────────
|
|
|
|
| 396 |
# BUILD UI
|
| 397 |
# =========================
|
| 398 |
|
| 399 |
+
CHALLENGES = [
|
| 400 |
+
{
|
| 401 |
+
"id": "object-localization",
|
| 402 |
+
"title": "Object Localization",
|
| 403 |
+
"emoji": "🎯",
|
| 404 |
+
"description": "Detect and segment objects in images taken by blind photographers. Submit bounding box and instance segmentation predictions evaluated with pycocotools.",
|
| 405 |
+
"metrics": "bbox_mAP · bbox_AP50 · segm_mAP · segm_AP50",
|
| 406 |
+
"active": True,
|
| 407 |
+
},
|
| 408 |
+
{
|
| 409 |
+
"id": "vqa",
|
| 410 |
+
"title": "Visual Question Answering",
|
| 411 |
+
"emoji": "🤔",
|
| 412 |
+
"description": "Answer open-ended questions about images taken by blind users. Models are evaluated on answer accuracy and relevance.",
|
| 413 |
+
"metrics": "Coming soon",
|
| 414 |
+
"active": False,
|
| 415 |
+
},
|
| 416 |
+
{
|
| 417 |
+
"id": "answer-grounding",
|
| 418 |
+
"title": "Answer Grounding",
|
| 419 |
+
"emoji": "📍",
|
| 420 |
+
"description": "Ground free-form answers to visual regions in images taken by blind photographers.",
|
| 421 |
+
"metrics": "Coming soon",
|
| 422 |
+
"active": False,
|
| 423 |
+
},
|
| 424 |
+
]
|
| 425 |
|
| 426 |
EVAL_DETAILS_MD = """
|
| 427 |
### How is the Score Calculated?
|
|
|
|
| 456 |
```
|
| 457 |
"""
|
| 458 |
|
| 459 |
+
OBJ_LOC_OVERVIEW_MD = """
|
| 460 |
+
## 🎯 Object Localization Challenge
|
| 461 |
+
|
| 462 |
+
Submit your model predictions and get scored automatically against hidden ground-truth annotations.
|
| 463 |
+
|
| 464 |
+
- 📤 **Submit Predictions** — Upload your prediction JSON for Dev, Standard, or Challenge phases
|
| 465 |
+
- 🏆 **Leaderboard** — View public rankings for the Standard phase
|
| 466 |
+
- 📋 **My Submissions** — Track all your past submissions and scores
|
| 467 |
+
"""
|
| 468 |
|
| 469 |
+
# Build challenge cards HTML for landing page
|
| 470 |
+
def _build_challenge_cards_html() -> str:
|
| 471 |
+
cards = ""
|
| 472 |
+
for c in CHALLENGES:
|
| 473 |
+
if c["active"]:
|
| 474 |
+
card = f"""
|
| 475 |
+
<div style="
|
| 476 |
+
border: 2px solid #2563eb;
|
| 477 |
+
border-radius: 12px;
|
| 478 |
+
padding: 24px;
|
| 479 |
+
background: #f0f7ff;
|
| 480 |
+
flex: 1;
|
| 481 |
+
min-width: 220px;
|
| 482 |
+
max-width: 340px;
|
| 483 |
+
">
|
| 484 |
+
<div style="font-size: 2.5rem; margin-bottom: 8px;">{c['emoji']}</div>
|
| 485 |
+
<h3 style="margin: 0 0 8px 0; color: #1e40af; font-size: 1.1rem;">{c['title']}</h3>
|
| 486 |
+
<p style="margin: 0 0 12px 0; color: #374151; font-size: 0.9rem; line-height: 1.5;">{c['description']}</p>
|
| 487 |
+
<div style="
|
| 488 |
+
background: #dbeafe;
|
| 489 |
+
border-radius: 6px;
|
| 490 |
+
padding: 6px 10px;
|
| 491 |
+
font-size: 0.78rem;
|
| 492 |
+
color: #1d4ed8;
|
| 493 |
+
font-family: monospace;
|
| 494 |
+
">📊 {c['metrics']}</div>
|
| 495 |
+
<div style="margin-top: 14px;">
|
| 496 |
+
<span style="
|
| 497 |
+
background: #2563eb;
|
| 498 |
+
color: white;
|
| 499 |
+
padding: 6px 14px;
|
| 500 |
+
border-radius: 6px;
|
| 501 |
+
font-size: 0.85rem;
|
| 502 |
+
font-weight: 600;
|
| 503 |
+
">✅ Active — scroll down to participate</span>
|
| 504 |
+
</div>
|
| 505 |
+
</div>"""
|
| 506 |
+
else:
|
| 507 |
+
card = f"""
|
| 508 |
+
<div style="
|
| 509 |
+
border: 2px solid #d1d5db;
|
| 510 |
+
border-radius: 12px;
|
| 511 |
+
padding: 24px;
|
| 512 |
+
background: #f9fafb;
|
| 513 |
+
flex: 1;
|
| 514 |
+
min-width: 220px;
|
| 515 |
+
max-width: 340px;
|
| 516 |
+
opacity: 0.65;
|
| 517 |
+
">
|
| 518 |
+
<div style="font-size: 2.5rem; margin-bottom: 8px;">{c['emoji']}</div>
|
| 519 |
+
<h3 style="margin: 0 0 8px 0; color: #6b7280; font-size: 1.1rem;">{c['title']}</h3>
|
| 520 |
+
<p style="margin: 0 0 12px 0; color: #9ca3af; font-size: 0.9rem; line-height: 1.5;">{c['description']}</p>
|
| 521 |
+
<div style="
|
| 522 |
+
background: #f3f4f6;
|
| 523 |
+
border-radius: 6px;
|
| 524 |
+
padding: 6px 10px;
|
| 525 |
+
font-size: 0.78rem;
|
| 526 |
+
color: #9ca3af;
|
| 527 |
+
font-family: monospace;
|
| 528 |
+
">📊 {c['metrics']}</div>
|
| 529 |
+
<div style="margin-top: 14px;">
|
| 530 |
+
<span style="
|
| 531 |
+
background: #e5e7eb;
|
| 532 |
+
color: #6b7280;
|
| 533 |
+
padding: 6px 14px;
|
| 534 |
+
border-radius: 6px;
|
| 535 |
+
font-size: 0.85rem;
|
| 536 |
+
font-weight: 600;
|
| 537 |
+
">🔒 Coming Soon</span>
|
| 538 |
+
</div>
|
| 539 |
+
</div>"""
|
| 540 |
+
cards += card
|
| 541 |
+
|
| 542 |
+
return f"""
|
| 543 |
+
<div style="display: flex; gap: 20px; flex-wrap: wrap; margin: 16px 0;">
|
| 544 |
+
{cards}
|
| 545 |
+
</div>
|
| 546 |
+
"""
|
| 547 |
+
|
| 548 |
+
|
| 549 |
+
with gr.Blocks(title="VizWiz Benchmark Arena", theme=gr.themes.Soft()) as demo:
|
| 550 |
|
| 551 |
+
# ── HEADER ───────────────────────────────────────────────────────────
|
| 552 |
with gr.Row():
|
| 553 |
+
with gr.Column(scale=5):
|
| 554 |
+
gr.Markdown("# 🏆 VizWiz Benchmark Arena")
|
| 555 |
+
gr.Markdown(
|
| 556 |
+
"An automated evaluation platform for VizWiz challenges — "
|
| 557 |
+
"datasets collected from blind photographers using a smartphone app."
|
| 558 |
+
)
|
| 559 |
+
with gr.Column(scale=1, min_width=160):
|
| 560 |
login_btn = gr.LoginButton(size="lg")
|
| 561 |
+
user_greeting = gr.Markdown("👋 Log in to submit.")
|
| 562 |
+
|
| 563 |
+
gr.Markdown("---")
|
| 564 |
+
|
| 565 |
+
# ── LANDING PAGE ─────────────────────────────────────────────────────
|
| 566 |
+
gr.Markdown("## Challenges")
|
| 567 |
+
gr.Markdown(
|
| 568 |
+
"Select a challenge below to view its leaderboard, submit predictions, "
|
| 569 |
+
"and track your results. New challenges will be added over time."
|
| 570 |
+
)
|
| 571 |
+
gr.HTML(_build_challenge_cards_html())
|
| 572 |
|
| 573 |
gr.Markdown("---")
|
| 574 |
|
| 575 |
+
# ── OBJECT LOCALIZATION CHALLENGE ────────────────────────────────────
|
| 576 |
+
gr.Markdown("## 🎯 Object Localization")
|
| 577 |
+
gr.Markdown(OBJ_LOC_OVERVIEW_MD)
|
| 578 |
+
|
| 579 |
with gr.Tabs():
|
| 580 |
|
| 581 |
# ── LEADERBOARD TAB ──────────────────────────────────────────────
|