Spaces:
Sleeping
Sleeping
| import io | |
| import pandas as pd | |
| from src.leaderboard.columns import RequiredInputColumns | |
| from src.utils import download_github_file_content | |
| # GitHub API endpoint for the file (handles Git LFS files) | |
| LEADERBOARD_API_URL = "https://api.github.com/repos/upgini/mle-bench/contents/rankings/low/tabular/overall_ranks.csv" | |
| def load_csv_from_github() -> pd.DataFrame: | |
| """Load the leaderboard CSV from GitHub.""" | |
| csv_content = download_github_file_content(LEADERBOARD_API_URL, timeout=30) | |
| df = pd.read_csv(io.StringIO(csv_content)) | |
| if df.empty: | |
| return pd.DataFrame(columns=RequiredInputColumns.values()) | |
| missing_cols = [col for col in RequiredInputColumns.values() if col not in df.columns] | |
| if missing_cols: | |
| raise ValueError(f"Leaderboard is missing expected columns: {', '.join(missing_cols)}") | |
| return df | |