import gradio as gr from auth_utils import get_user_greeting CHALLENGES = [ { "id": "object-localization", "title": "Object Localization", "emoji": "🎯", "description": "Detect and segment objects in images taken by blind photographers. Submit bounding box and instance segmentation predictions evaluated with pycocotools.", "metrics": "bbox_mAP · bbox_AP50 · segm_mAP · segm_AP50", "route": "/object-localization", "active": True, }, { "id": "vqa", "title": "Visual Question Answering", "emoji": "🤔", "description": "Answer open-ended questions about images taken by blind users. Models are evaluated on answer accuracy and relevance.", "metrics": "Coming soon", "route": "/vqa", "active": True, }, { "id": "answer-therapy", "title": "VQA Answer Therapy", "emoji": "📍", "description": "Predict whether a visual question produces answers that all share the same image region. Evaluated with F1, Precision, and Recall across VizWiz and VQAv2 subsets.", "metrics": "Overall F1 · VizWiz F1 · VQAv2 F1", "route": "/answer-therapy", "active": True, }, ] def _single_card_html(c: dict) -> str: if c["active"]: return f"""
{c['emoji']}

{c['title']}

{c['description']}

📊 {c['metrics']}
""" else: return f"""
{c['emoji']}

{c['title']}

{c['description']}

📊 {c['metrics']}
""" def _all_cards_html(challenges: list) -> str: cards = "".join(_single_card_html(c) for c in challenges) return f"""
{cards}
""" def build_home(demo: gr.Blocks) -> None: with gr.Row(): with gr.Column(scale=5): gr.Markdown("# 🏆 VizWiz Challenges") gr.Markdown( "Automated evaluation platform for VizWiz challenges — " "datasets collected from blind photographers using a smartphone app." ) with gr.Column(scale=1, min_width=160): gr.LoginButton(size="lg") home_greeting = gr.Markdown("👋 Log in to submit.") gr.Markdown("---") gr.Markdown("## Challenges") gr.Markdown( "Choose a challenge to view its leaderboard, submit predictions, and track your results." ) gr.HTML(_all_cards_html(CHALLENGES)) gr.Markdown( "---\n*More challenges coming soon. " "All challenges use HuggingFace OAuth — log in once to access everything.*" ) demo.load(get_user_greeting, outputs=[home_greeting])