deploy portal
Browse files
app.py
CHANGED
|
@@ -45,11 +45,6 @@ ACTION_TEXT = {"slot": "→ slot {slot}", "replace": "replaces slot {slot} ({old
|
|
| 45 |
"skipped_full": "skipped: {note}", "capped": "not recorded: {note}"}
|
| 46 |
|
| 47 |
|
| 48 |
-
def lang_choices(track: Optional[str]) -> list[tuple[str, str]]:
|
| 49 |
-
codes = TRACKS.get(track or "") or sorted({c for langs in TRACKS.values() for c in langs})
|
| 50 |
-
return [(display_name(code), code) for code in codes]
|
| 51 |
-
|
| 52 |
-
|
| 53 |
def deadline_text() -> str:
|
| 54 |
d = settings.deadline.astimezone(dt.timezone.utc)
|
| 55 |
return f"{d:%A %d %B %Y, %H:%M} UTC (23:59 AoE on {(d - dt.timedelta(hours=12)):%d %B})"
|
|
@@ -152,26 +147,23 @@ def slot_panel(key: SlotKey, team: Team, manifest: dict[str, Any]) -> str:
|
|
| 152 |
f"{manifest.get('uploads', 0)} / {settings.max_uploads_per_key}")
|
| 153 |
|
| 154 |
|
| 155 |
-
def
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
def on_validate(team_name, track, lang, llm, retriever, system_type, email, file):
|
| 160 |
-
"""Validate one file; on success show the slot panel and enable submission."""
|
| 161 |
def fail(msg: str, report_path: Optional[str] = None):
|
| 162 |
return (msg, gr.update(value=report_path, visible=report_path is not None), gr.update(value="", visible=False),
|
| 163 |
gr.update(visible=False, choices=[], value=None), gr.update(visible=False), None)
|
| 164 |
|
| 165 |
-
err, team, path = _common_checks(team_name, track, llm, retriever, system_type, email, file
|
| 166 |
if err:
|
| 167 |
return fail(err)
|
| 168 |
original = os.path.basename(path)
|
| 169 |
if is_zip(path):
|
| 170 |
return fail("This is a zip archive. Use the **Whole track (zip)** tab for it, or upload one per-language `.jsonl` here.")
|
| 171 |
try:
|
| 172 |
-
report = single_file_report(path, track=track, lang=
|
| 173 |
except UsageProblem as exc:
|
| 174 |
return fail(f"Could not validate: {exc}")
|
|
|
|
| 175 |
log.info("validated team=%s track=%s lang=%s file=%s size=%d status=%s errors=%d warnings=%d",
|
| 176 |
team.slug, track, lang, original, os.path.getsize(path), report.status, report.n_errors, report.n_warnings)
|
| 177 |
text = render(report, color=False, unicode=True)
|
|
@@ -184,7 +176,7 @@ def on_validate(team_name, track, lang, llm, retriever, system_type, email, file
|
|
| 184 |
manifest, _ = slots.manifest(key, team.name)
|
| 185 |
free = slots.next_free_slot(manifest)
|
| 186 |
head = ("### ✓ Validation passed" + (" with warnings" if report.n_warnings else "")
|
| 187 |
-
+ f" —
|
| 188 |
if free is not None:
|
| 189 |
submit = gr.update(visible=True, value=f"Submit to slot {free}")
|
| 190 |
replace = gr.update(visible=False, choices=[], value=None)
|
|
@@ -407,13 +399,12 @@ with gr.Blocks(title="MAST 2026 submission", analytics_enabled=False) as demo:
|
|
| 407 |
with gr.Column():
|
| 408 |
team_name = gr.Textbox(label="Team name", placeholder="exactly as on the registration form")
|
| 409 |
track = gr.Radio(choices=[(v, k) for k, v in TRACK_LABELS.items()], label="Track", value=None)
|
| 410 |
-
language = gr.Dropdown(choices=lang_choices(None), label="Language", value=None)
|
| 411 |
system_type = gr.Radio(choices=SYSTEM_TYPES, label="System type", value=None)
|
| 412 |
with gr.Column():
|
| 413 |
llm = gr.Textbox(label="LLM", placeholder="e.g. Alibaba-NLP/Tongyi-DeepResearch-30B-A3B")
|
| 414 |
retriever = gr.Textbox(label="Retriever", placeholder="e.g. Qwen/Qwen3-Embedding-8B or BM25")
|
| 415 |
email = gr.Textbox(label="Contact email", placeholder="receipt goes here and to the team contact")
|
| 416 |
-
upload = gr.File(label="Run file (.jsonl or .jsonl.gz, one language)", file_types=[".jsonl", ".gz"], type="filepath")
|
| 417 |
validate_btn = gr.Button("Validate", variant="primary")
|
| 418 |
status = gr.Markdown()
|
| 419 |
report_dl = gr.DownloadButton("Download validation report (JSON)", visible=False)
|
|
@@ -431,8 +422,7 @@ with gr.Blocks(title="MAST 2026 submission", analytics_enabled=False) as demo:
|
|
| 431 |
z_validate.click(on_validate_zip, inputs=[z_team, z_track, z_llm, z_retr, z_system, z_email, z_replace, z_file],
|
| 432 |
outputs=[z_status, z_report_dl, z_unused, z_submit, z_state])
|
| 433 |
z_submit.click(on_submit_zip, inputs=[z_state], outputs=[z_result, z_receipt_dl, z_unused, z_submit, z_state])
|
| 434 |
-
|
| 435 |
-
validate_btn.click(on_validate, inputs=[team_name, track, language, llm, retriever, system_type, email, upload],
|
| 436 |
outputs=[status, report_dl, slot_md, replace_radio, submit_btn, state])
|
| 437 |
submit_btn.click(on_submit, inputs=[state, replace_radio],
|
| 438 |
outputs=[receipt_md, receipt_dl, slot_md, submit_btn, replace_radio, state])
|
|
|
|
| 45 |
"skipped_full": "skipped: {note}", "capped": "not recorded: {note}"}
|
| 46 |
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
def deadline_text() -> str:
|
| 49 |
d = settings.deadline.astimezone(dt.timezone.utc)
|
| 50 |
return f"{d:%A %d %B %Y, %H:%M} UTC (23:59 AoE on {(d - dt.timedelta(hours=12)):%d %B})"
|
|
|
|
| 147 |
f"{manifest.get('uploads', 0)} / {settings.max_uploads_per_key}")
|
| 148 |
|
| 149 |
|
| 150 |
+
def on_validate(team_name, track, llm, retriever, system_type, email, file):
|
| 151 |
+
"""Validate one file; its language comes from the records. On success show the slot panel."""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
def fail(msg: str, report_path: Optional[str] = None):
|
| 153 |
return (msg, gr.update(value=report_path, visible=report_path is not None), gr.update(value="", visible=False),
|
| 154 |
gr.update(visible=False, choices=[], value=None), gr.update(visible=False), None)
|
| 155 |
|
| 156 |
+
err, team, path = _common_checks(team_name, track, llm, retriever, system_type, email, file)
|
| 157 |
if err:
|
| 158 |
return fail(err)
|
| 159 |
original = os.path.basename(path)
|
| 160 |
if is_zip(path):
|
| 161 |
return fail("This is a zip archive. Use the **Whole track (zip)** tab for it, or upload one per-language `.jsonl` here.")
|
| 162 |
try:
|
| 163 |
+
report = single_file_report(path, track=track, lang=None, name=original)
|
| 164 |
except UsageProblem as exc:
|
| 165 |
return fail(f"Could not validate: {exc}")
|
| 166 |
+
lang = report.files[0].language
|
| 167 |
log.info("validated team=%s track=%s lang=%s file=%s size=%d status=%s errors=%d warnings=%d",
|
| 168 |
team.slug, track, lang, original, os.path.getsize(path), report.status, report.n_errors, report.n_warnings)
|
| 169 |
text = render(report, color=False, unicode=True)
|
|
|
|
| 176 |
manifest, _ = slots.manifest(key, team.name)
|
| 177 |
free = slots.next_free_slot(manifest)
|
| 178 |
head = ("### ✓ Validation passed" + (" with warnings" if report.n_warnings else "")
|
| 179 |
+
+ f" — team **{team.name}**, language **{display_name(lang)}** (read from the records)\nReview the slots below, then submit.")
|
| 180 |
if free is not None:
|
| 181 |
submit = gr.update(visible=True, value=f"Submit to slot {free}")
|
| 182 |
replace = gr.update(visible=False, choices=[], value=None)
|
|
|
|
| 399 |
with gr.Column():
|
| 400 |
team_name = gr.Textbox(label="Team name", placeholder="exactly as on the registration form")
|
| 401 |
track = gr.Radio(choices=[(v, k) for k, v in TRACK_LABELS.items()], label="Track", value=None)
|
|
|
|
| 402 |
system_type = gr.Radio(choices=SYSTEM_TYPES, label="System type", value=None)
|
| 403 |
with gr.Column():
|
| 404 |
llm = gr.Textbox(label="LLM", placeholder="e.g. Alibaba-NLP/Tongyi-DeepResearch-30B-A3B")
|
| 405 |
retriever = gr.Textbox(label="Retriever", placeholder="e.g. Qwen/Qwen3-Embedding-8B or BM25")
|
| 406 |
email = gr.Textbox(label="Contact email", placeholder="receipt goes here and to the team contact")
|
| 407 |
+
upload = gr.File(label="Run file (.jsonl or .jsonl.gz, one language; the records say which)", file_types=[".jsonl", ".gz"], type="filepath")
|
| 408 |
validate_btn = gr.Button("Validate", variant="primary")
|
| 409 |
status = gr.Markdown()
|
| 410 |
report_dl = gr.DownloadButton("Download validation report (JSON)", visible=False)
|
|
|
|
| 422 |
z_validate.click(on_validate_zip, inputs=[z_team, z_track, z_llm, z_retr, z_system, z_email, z_replace, z_file],
|
| 423 |
outputs=[z_status, z_report_dl, z_unused, z_submit, z_state])
|
| 424 |
z_submit.click(on_submit_zip, inputs=[z_state], outputs=[z_result, z_receipt_dl, z_unused, z_submit, z_state])
|
| 425 |
+
validate_btn.click(on_validate, inputs=[team_name, track, llm, retriever, system_type, email, upload],
|
|
|
|
| 426 |
outputs=[status, report_dl, slot_md, replace_radio, submit_btn, state])
|
| 427 |
submit_btn.click(on_submit, inputs=[state, replace_radio],
|
| 428 |
outputs=[receipt_md, receipt_dl, slot_md, submit_btn, replace_radio, state])
|