Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -318,6 +318,7 @@ def handle_submit(file, team, model_name, phase_label, challenge_type, profile:
|
|
| 318 |
remaining = DAILY_SUBMISSION_CAP - subs_today - 1
|
| 319 |
return (
|
| 320 |
f"β
Submission queued successfully! Visit **My Submissions** to see the results. You have {remaining}/{DAILY_SUBMISSION_CAP} submissions remaining today.",
|
|
|
|
| 321 |
)
|
| 322 |
|
| 323 |
|
|
@@ -397,7 +398,9 @@ def get_user_greeting(profile: gr.OAuthProfile | None):
|
|
| 397 |
|
| 398 |
EVAL_DETAILS_MD = """
|
| 399 |
### How is the Score Calculated?
|
|
|
|
| 400 |
Your submission is evaluated automatically against hidden ground-truth annotations using **pycocotools**.
|
|
|
|
| 401 |
| Metric | Description |
|
| 402 |
|--------|-------------|
|
| 403 |
| `bbox_mAP` | Bounding box mean average precision |
|
|
@@ -408,7 +411,9 @@ Your submission is evaluated automatically against hidden ground-truth annotatio
|
|
| 408 |
|
| 409 |
FORMAT_MD = """
|
| 410 |
### Submission Format
|
|
|
|
| 411 |
Your JSON file must be a **list of annotation objects**, each containing:
|
|
|
|
| 412 |
```json
|
| 413 |
[
|
| 414 |
{
|
|
@@ -455,43 +460,38 @@ CHALLENGES = [
|
|
| 455 |
]
|
| 456 |
|
| 457 |
|
| 458 |
-
def
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
<
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
<div style="
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
<div style="background:#f3f4f6;border-radius:6px;padding:5px 10px;
|
| 485 |
-
font-size:0.75rem;color:#9ca3af;font-family:monospace;margin-bottom:12px;">
|
| 486 |
-
π {c['metrics']}
|
| 487 |
-
</div>
|
| 488 |
<span style="background:#e5e7eb;color:#6b7280;padding:7px 16px;
|
| 489 |
border-radius:6px;font-size:0.85rem;font-weight:600;">
|
| 490 |
π Coming Soon
|
| 491 |
</span>
|
| 492 |
-
</div>
|
| 493 |
-
|
| 494 |
-
return f'<div style="display:flex;gap:20px;flex-wrap:wrap;margin:16px 0 24px 0;">{cards}</div>'
|
| 495 |
|
| 496 |
|
| 497 |
# =========================
|
|
@@ -517,7 +517,14 @@ with gr.Blocks() as demo:
|
|
| 517 |
gr.Markdown(
|
| 518 |
"Choose a challenge to view its leaderboard, submit predictions, and track your results."
|
| 519 |
)
|
| 520 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 521 |
gr.Markdown(
|
| 522 |
"---\n*More challenges coming soon. "
|
| 523 |
"All challenges use HuggingFace OAuth β log in once to access everything.*"
|
|
|
|
| 318 |
remaining = DAILY_SUBMISSION_CAP - subs_today - 1
|
| 319 |
return (
|
| 320 |
f"β
Submission queued successfully! Visit **My Submissions** to see the results. You have {remaining}/{DAILY_SUBMISSION_CAP} submissions remaining today.",
|
| 321 |
+
submission_id,
|
| 322 |
)
|
| 323 |
|
| 324 |
|
|
|
|
| 398 |
|
| 399 |
EVAL_DETAILS_MD = """
|
| 400 |
### How is the Score Calculated?
|
| 401 |
+
|
| 402 |
Your submission is evaluated automatically against hidden ground-truth annotations using **pycocotools**.
|
| 403 |
+
|
| 404 |
| Metric | Description |
|
| 405 |
|--------|-------------|
|
| 406 |
| `bbox_mAP` | Bounding box mean average precision |
|
|
|
|
| 411 |
|
| 412 |
FORMAT_MD = """
|
| 413 |
### Submission Format
|
| 414 |
+
|
| 415 |
Your JSON file must be a **list of annotation objects**, each containing:
|
| 416 |
+
|
| 417 |
```json
|
| 418 |
[
|
| 419 |
{
|
|
|
|
| 460 |
]
|
| 461 |
|
| 462 |
|
| 463 |
+
def _challenge_card_html(c: dict) -> str:
|
| 464 |
+
"""Return HTML for a single challenge card (no navigation button β use gr.Button instead)."""
|
| 465 |
+
if c["active"]:
|
| 466 |
+
return f"""
|
| 467 |
+
<div style="border:2px solid #2563eb;border-radius:12px;padding:24px;
|
| 468 |
+
background:#f0f7ff;height:100%;">
|
| 469 |
+
<div style="font-size:2.2rem;margin-bottom:8px;">{c['emoji']}</div>
|
| 470 |
+
<h3 style="margin:0 0 8px 0;color:#1e40af;font-size:1.05rem;">{c['title']}</h3>
|
| 471 |
+
<p style="margin:0 0 12px 0;color:#374151;font-size:0.88rem;line-height:1.5;">{c['description']}</p>
|
| 472 |
+
<div style="background:#dbeafe;border-radius:6px;padding:5px 10px;
|
| 473 |
+
font-size:0.75rem;color:#1d4ed8;font-family:monospace;">
|
| 474 |
+
π {c['metrics']}
|
| 475 |
+
</div>
|
| 476 |
+
</div>"""
|
| 477 |
+
else:
|
| 478 |
+
return f"""
|
| 479 |
+
<div style="border:2px solid #e5e7eb;border-radius:12px;padding:24px;
|
| 480 |
+
background:#f9fafb;opacity:0.6;height:100%;">
|
| 481 |
+
<div style="font-size:2.2rem;margin-bottom:8px;">{c['emoji']}</div>
|
| 482 |
+
<h3 style="margin:0 0 8px 0;color:#6b7280;font-size:1.05rem;">{c['title']}</h3>
|
| 483 |
+
<p style="margin:0 0 12px 0;color:#9ca3af;font-size:0.88rem;line-height:1.5;">{c['description']}</p>
|
| 484 |
+
<div style="background:#f3f4f6;border-radius:6px;padding:5px 10px;
|
| 485 |
+
font-size:0.75rem;color:#9ca3af;font-family:monospace;">
|
| 486 |
+
π {c['metrics']}
|
| 487 |
+
</div>
|
| 488 |
+
<div style="margin-top:14px;">
|
|
|
|
|
|
|
|
|
|
|
|
|
| 489 |
<span style="background:#e5e7eb;color:#6b7280;padding:7px 16px;
|
| 490 |
border-radius:6px;font-size:0.85rem;font-weight:600;">
|
| 491 |
π Coming Soon
|
| 492 |
</span>
|
| 493 |
+
</div>
|
| 494 |
+
</div>"""
|
|
|
|
| 495 |
|
| 496 |
|
| 497 |
# =========================
|
|
|
|
| 517 |
gr.Markdown(
|
| 518 |
"Choose a challenge to view its leaderboard, submit predictions, and track your results."
|
| 519 |
)
|
| 520 |
+
with gr.Row(equal_height=True):
|
| 521 |
+
for c in CHALLENGES:
|
| 522 |
+
with gr.Column():
|
| 523 |
+
gr.HTML(_challenge_card_html(c))
|
| 524 |
+
if c["active"]:
|
| 525 |
+
btn = gr.Button(f"Enter {c['title']} β", variant="primary", size="sm")
|
| 526 |
+
btn.click(None, js=f"() => {{ window.location.href = '{c['route']}'; }}")
|
| 527 |
+
|
| 528 |
gr.Markdown(
|
| 529 |
"---\n*More challenges coming soon. "
|
| 530 |
"All challenges use HuggingFace OAuth β log in once to access everything.*"
|