"""Gradio app for the PLUG challenge. Four tabs — About, Submit, Leaderboard, FAQ — whose content is gated on ``config.CURRENT_PHASE``. All challenge-specific copy comes from ``config`` and all benchmark facts from ``plug_challenge.benchmarks``; this module only decides the layout. """ import gradio as gr from gradio.themes.utils import sizes from loguru import logger from config import ( ABOUT_MD, CHALLENGE_ANNOUNCEMENT_LINK, CURRENT_PHASE, DATASET_DOWNLOAD_LINK, FAQ_MD, HEADER_MARKDOWN, PAGE_TITLE, ) from leaderboards import render_leaderboards from submission import render_submission_tab _TABLE_CSS = """ """ def _link_button(url: str, label: str, colour: str) -> str: """Render one prominent call-to-action link.""" return f"""
""" with gr.Blocks( title=PAGE_TITLE, fill_height=False, theme=gr.themes.Ocean(text_size=sizes.text_lg), ) as demo: gr.Markdown(HEADER_MARKDOWN) gr.HTML(_TABLE_CSS) with gr.Row(): with gr.Column(scale=1): if CHALLENGE_ANNOUNCEMENT_LINK: gr.HTML(_link_button(CHALLENGE_ANNOUNCEMENT_LINK, "📄 About PLUG →", "#2563eb")) with gr.Column(scale=1): # Hidden before the challenge opens: the data is released when submissions do. if DATASET_DOWNLOAD_LINK and CURRENT_PHASE >= 1: gr.HTML(_link_button(DATASET_DOWNLOAD_LINK, "🗄️ Challenge data →", "#059669")) with gr.Tabs(elem_classes="tab-buttons"): with gr.TabItem("📖 About"): gr.Markdown(ABOUT_MD, elem_id="welcome-md") with gr.TabItem("✉️ Submit"): render_submission_tab(phase=CURRENT_PHASE) with gr.TabItem("🏁 Leaderboard" if CURRENT_PHASE >= 2 else "🏎️ Leaderboard"): render_leaderboards(phase=CURRENT_PHASE, demo=demo) with gr.TabItem("🛠️ FAQ"): gr.Markdown(FAQ_MD, elem_id="faq-md") if __name__ == "__main__": logger.info("Starting the PLUG challenge Gradio app (phase {})...", CURRENT_PHASE) demo.launch()