# -*- coding: utf-8 -*-
"""Gradio frontend for the MLE‑Dojo leaderboard.
Changes made in this version
----------------------------
1. **Fixed CSS syntax errors** (missing semicolons, misplaced `!important`).
2. **Introduced a single, clean rule‑set** for the introduction block so the
font size, family and alignment are now reliably applied.
3. All new comments are in English for clarity.
4. Adjusted font sizes for Radio button labels per user request.
5. **Added dark mode support** using `@media (prefers-color-scheme: dark)`
to override conflicting styles and ensure readability in dark themes.
"""
import gradio as gr
import pandas as pd
from apscheduler.schedulers.background import BackgroundScheduler
# ---------------------------------------------------------------------------
# Optional imports from the project package. If they fail we fall back to
# placeholders so the app still launches locally.
# ---------------------------------------------------------------------------
try:
from src.about import (
CITATION_BUTTON_LABEL,
CITATION_BUTTON_TEXT,
EVALUATION_QUEUE_TEXT, # still referenced in commented‑out submit tab
INTRODUCTION_TEXT,
LLM_BENCHMARKS_TEXT,
TITLE, # contains
)
try:
from src.display.css_html_js import custom_css # extra project CSS
except ImportError:
print("Warning: src.display.css_html_js not found. Using empty CSS.")
custom_css = ""
from src.envs import REPO_ID
from src.submission.submit import add_new_eval
except ImportError:
# -------- PLACEHOLDERS so the Space can still run --------
print("Warning: using placeholder values because src module imports failed.")
CITATION_BUTTON_LABEL = "Citation"
CITATION_BUTTON_TEXT = """@misc{qiang2025mledojointeractiveenvironmentsempowering,
title={MLE-Dojo: Interactive Environments for Empowering LLM Agents in Machine Learning Engineering},
author={Rushi Qiang and Yuchen Zhuang and Yinghao Li and Dingu Sagar V K and Rongzhi Zhang and Changhao Li and Ian Shu-Hei Wong and Sherry Yang and Percy Liang and Chao Zhang and Bo Dai},
year={2025},
eprint={2505.07782},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2505.07782},
}"""
EVALUATION_QUEUE_TEXT = "Current evaluation queue:"
TITLE = (
"🏆 MLE-Dojo "
"Benchmark Leaderboard (Placeholder)
"
)
INTRODUCTION_TEXT = (
""
"
Welcome to the MLE‑Dojo Benchmark Leaderboard (placeholder).
"
"
Edit src/about.py
to change this text.
"
"
"
)
LLM_BENCHMARKS_TEXT = (
"## About Section (placeholder)\nInformation about the benchmarks goes here."
)
custom_css = ""
REPO_ID = "your/space-id"
# Dummy function so the callback in the (commented) submit tab still works
def add_new_eval(*_):
return "Submission placeholder."
# icons_html = """
#