File size: 2,700 Bytes
c43d006 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
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=\"<repo-id>\")`.
2. The pipeline must return
`{"answer": str, "confidence": float, "buzz": bool}`.
3. Runtime limit: **15 min / 1k examples** (T4 GPU).
Enter the <username>/<repo-name> 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=\"<repo-id>\")`.
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 <username>/<repo-name> 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,
)
|