import gradio as gr from submission.submit import create_hf_submission def create_hf_pipeline_submission_interface(demo: gr.Blocks): with gr.Tabs(): with gr.TabItem("Tossup"): gr.Markdown( """ # 📝 QuizBowl Tossup (QBT) – Submit your model 1. Your repo **must load with** `pipeline(task=\"quizbowl-tossup\", model=\"\")`. 2. The pipeline must return `{"answer": str, "confidence": float, "buzz": bool}`. 3. Runtime limit: **15 min / 1k examples** (T4 GPU). Enter the / below and hit **Evaluate**. """ ) with gr.Row(): tossup_model_box = gr.Textbox( label="Hugging Face repo or model ID", placeholder="e.g. yourname/my-qbt-model" ) tossup_submit_btn = gr.Button("Evaluate") tossup_output_json = gr.JSON(label="Tossup Metrics") tossup_submit_btn.click( lambda model_id: create_hf_submission(model_id, model_id, "", "tossup"), inputs=tossup_model_box, outputs=[tossup_output_json], concurrency_limit=1, ) with gr.TabItem("Bonus"): gr.Markdown( """ # 🎁 QuizBowl Bonus (QBB) – Submit your model 1. Your repo **must load with** `pipeline(task=\"quizbowl-bonus\", model=\"\")`. 2. The pipeline must return `{"answer": str, "confidence": float, "explanation": str}`. 3. Runtime limit: **15 min / 1k examples** (T4 GPU). - Each bonus question has a `leadin` and a `part`. - Your model will be called for each part with the same leadin and a different part. - The output should include a brief explanation for human collaboration. Enter the / below and hit **Evaluate**. """ ) with gr.Row(): bonus_model_box = gr.Textbox( label="Hugging Face repo or model ID", placeholder="e.g. yourname/my-qbb-model" ) bonus_submit_btn = gr.Button("Evaluate") bonus_output_json = gr.JSON(label="Bonus Metrics") bonus_submit_btn.click( lambda model_id: create_hf_submission(model_id, model_id, "", "bonus"), inputs=bonus_model_box, outputs=[bonus_output_json], concurrency_limit=1, )