Spaces:
Sleeping
Sleeping
sunmarinup commited on
Commit ·
b5ca9c0
1
Parent(s): ab2d497
Fix tests
Browse files
app.py
CHANGED
|
@@ -58,6 +58,9 @@ def download_leaderboard() -> pd.DataFrame:
|
|
| 58 |
raise ValueError("No content or download_url found in API response")
|
| 59 |
|
| 60 |
df = pd.read_csv(io.StringIO(csv_content))
|
|
|
|
|
|
|
|
|
|
| 61 |
missing_cols = [col for col in DISPLAY_COLUMNS if col not in df.columns]
|
| 62 |
if missing_cols:
|
| 63 |
raise ValueError(f"Leaderboard is missing expected columns: {', '.join(missing_cols)}")
|
|
@@ -81,27 +84,34 @@ def refresh_leaderboard():
|
|
| 81 |
return df, status
|
| 82 |
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
-
demo.load(refresh_leaderboard, outputs=[leaderboard_table, status_text])
|
| 105 |
-
refresh_button.click(refresh_leaderboard, outputs=[leaderboard_table, status_text])
|
| 106 |
|
| 107 |
-
|
|
|
|
|
|
|
|
|
| 58 |
raise ValueError("No content or download_url found in API response")
|
| 59 |
|
| 60 |
df = pd.read_csv(io.StringIO(csv_content))
|
| 61 |
+
if df.empty:
|
| 62 |
+
return df
|
| 63 |
+
|
| 64 |
missing_cols = [col for col in DISPLAY_COLUMNS if col not in df.columns]
|
| 65 |
if missing_cols:
|
| 66 |
raise ValueError(f"Leaderboard is missing expected columns: {', '.join(missing_cols)}")
|
|
|
|
| 84 |
return df, status
|
| 85 |
|
| 86 |
|
| 87 |
+
def create_app():
|
| 88 |
+
"""Create and configure the Gradio app without launching it."""
|
| 89 |
+
with gr.Blocks(title="Upgini MLE-Bench Leaderboard") as demo:
|
| 90 |
+
gr.Markdown(
|
| 91 |
+
"""
|
| 92 |
+
# Upgini MLE-Bench Tabular Leaderboard
|
| 93 |
|
| 94 |
+
This app mirrors the remote leaderboard so you always see the latest public results.
|
| 95 |
+
Click **Refresh leaderboard** any time to re-download the CSV from GitHub.
|
| 96 |
+
"""
|
| 97 |
+
)
|
| 98 |
|
| 99 |
+
leaderboard_table = gr.DataFrame(
|
| 100 |
+
value=pd.DataFrame(columns=DISPLAY_COLUMNS),
|
| 101 |
+
wrap=True,
|
| 102 |
+
interactive=False,
|
| 103 |
+
type="pandas",
|
| 104 |
+
label="Leaderboard",
|
| 105 |
+
)
|
| 106 |
+
status_text = gr.Markdown()
|
| 107 |
+
refresh_button = gr.Button("Refresh leaderboard", variant="primary")
|
| 108 |
+
|
| 109 |
+
demo.load(refresh_leaderboard, outputs=[leaderboard_table, status_text])
|
| 110 |
+
refresh_button.click(refresh_leaderboard, outputs=[leaderboard_table, status_text])
|
| 111 |
+
|
| 112 |
+
return demo
|
| 113 |
|
|
|
|
|
|
|
| 114 |
|
| 115 |
+
if __name__ == "__main__":
|
| 116 |
+
demo = create_app()
|
| 117 |
+
demo.queue(default_concurrency_limit=8).launch()
|