Spaces:
Sleeping
Sleeping
Nicolas Wagner commited on
Commit ·
b5a5f3d
1
Parent(s): c3e7c31
adjust size
Browse files- app.py +26 -12
- src/about.py +1 -1
app.py
CHANGED
|
@@ -122,6 +122,7 @@ def init_leaderboard(dataframe):
|
|
| 122 |
filter_columns=[],
|
| 123 |
hide_columns=[],
|
| 124 |
interactive=False,
|
|
|
|
| 125 |
)
|
| 126 |
|
| 127 |
dataframe = dataframe[
|
|
@@ -171,6 +172,7 @@ def init_leaderboard(dataframe):
|
|
| 171 |
hide_columns=hide_cols if hide_cols else [],
|
| 172 |
filter_columns=[],
|
| 173 |
interactive=False,
|
|
|
|
| 174 |
)
|
| 175 |
|
| 176 |
|
|
@@ -198,25 +200,29 @@ def submit_csv_ui(token: str, csv_file):
|
|
| 198 |
updated_leaderboard_df = get_leaderboard_df(SUBMISSIONS_PATH, COLS)
|
| 199 |
|
| 200 |
if not token or not token.strip():
|
| 201 |
-
|
|
|
|
| 202 |
|
| 203 |
if csv_file is None:
|
| 204 |
-
|
|
|
|
| 205 |
|
| 206 |
try:
|
| 207 |
with open(csv_file.name, "r") as f:
|
| 208 |
csv_content = f.read()
|
| 209 |
except Exception as e:
|
| 210 |
-
|
|
|
|
| 211 |
|
| 212 |
success, message = submit_csv(token, csv_content)
|
| 213 |
|
| 214 |
updated_leaderboard_df = get_leaderboard_df(SUBMISSIONS_PATH, COLS)
|
|
|
|
| 215 |
|
| 216 |
if success:
|
| 217 |
-
return styled_message(message), updated_leaderboard_df
|
| 218 |
else:
|
| 219 |
-
return styled_error(message), updated_leaderboard_df
|
| 220 |
|
| 221 |
|
| 222 |
def refresh_leaderboard():
|
|
@@ -224,6 +230,11 @@ def refresh_leaderboard():
|
|
| 224 |
return fresh_df
|
| 225 |
|
| 226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
logo_image_path = os.path.abspath("assets/logo.png")
|
| 228 |
|
| 229 |
demo = gr.Blocks(css=custom_css, theme=gr.themes.Soft())
|
|
@@ -310,12 +321,6 @@ with demo:
|
|
| 310 |
submit_button = gr.Button("Submit CSV", variant="primary")
|
| 311 |
submission_result = gr.Markdown()
|
| 312 |
|
| 313 |
-
submit_button.click(
|
| 314 |
-
submit_csv_ui,
|
| 315 |
-
[token_input, csv_file_input],
|
| 316 |
-
[submission_result, leaderboard],
|
| 317 |
-
)
|
| 318 |
-
|
| 319 |
with gr.Accordion("📊 Submission History", open=False):
|
| 320 |
with gr.Tabs():
|
| 321 |
with gr.TabItem("✅ Accepted Submissions"):
|
|
@@ -337,7 +342,16 @@ with demo:
|
|
| 337 |
row_count=10,
|
| 338 |
)
|
| 339 |
|
| 340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
|
| 342 |
if __name__ == "__main__":
|
| 343 |
scheduler = BackgroundScheduler()
|
|
|
|
| 122 |
filter_columns=[],
|
| 123 |
hide_columns=[],
|
| 124 |
interactive=False,
|
| 125 |
+
height=800,
|
| 126 |
)
|
| 127 |
|
| 128 |
dataframe = dataframe[
|
|
|
|
| 172 |
hide_columns=hide_cols if hide_cols else [],
|
| 173 |
filter_columns=[],
|
| 174 |
interactive=False,
|
| 175 |
+
height=800,
|
| 176 |
)
|
| 177 |
|
| 178 |
|
|
|
|
| 200 |
updated_leaderboard_df = get_leaderboard_df(SUBMISSIONS_PATH, COLS)
|
| 201 |
|
| 202 |
if not token or not token.strip():
|
| 203 |
+
accepted, rejected, all_subs = get_submission_queue_df(SUBMISSIONS_PATH, SUBMISSION_COLS)
|
| 204 |
+
return styled_error("Please provide your team token."), updated_leaderboard_df, accepted, rejected, all_subs
|
| 205 |
|
| 206 |
if csv_file is None:
|
| 207 |
+
accepted, rejected, all_subs = get_submission_queue_df(SUBMISSIONS_PATH, SUBMISSION_COLS)
|
| 208 |
+
return styled_error("Please upload a CSV file."), updated_leaderboard_df, accepted, rejected, all_subs
|
| 209 |
|
| 210 |
try:
|
| 211 |
with open(csv_file.name, "r") as f:
|
| 212 |
csv_content = f.read()
|
| 213 |
except Exception as e:
|
| 214 |
+
accepted, rejected, all_subs = get_submission_queue_df(SUBMISSIONS_PATH, SUBMISSION_COLS)
|
| 215 |
+
return styled_error(f"Could not read CSV file: {str(e)}"), updated_leaderboard_df, accepted, rejected, all_subs
|
| 216 |
|
| 217 |
success, message = submit_csv(token, csv_content)
|
| 218 |
|
| 219 |
updated_leaderboard_df = get_leaderboard_df(SUBMISSIONS_PATH, COLS)
|
| 220 |
+
accepted, rejected, all_subs = get_submission_queue_df(SUBMISSIONS_PATH, SUBMISSION_COLS)
|
| 221 |
|
| 222 |
if success:
|
| 223 |
+
return styled_message(message), updated_leaderboard_df, accepted, rejected, all_subs
|
| 224 |
else:
|
| 225 |
+
return styled_error(message), updated_leaderboard_df, accepted, rejected, all_subs
|
| 226 |
|
| 227 |
|
| 228 |
def refresh_leaderboard():
|
|
|
|
| 230 |
return fresh_df
|
| 231 |
|
| 232 |
|
| 233 |
+
def refresh_submission_history():
|
| 234 |
+
accepted, rejected, all_subs = get_submission_queue_df(SUBMISSIONS_PATH, SUBMISSION_COLS)
|
| 235 |
+
return accepted, rejected, all_subs
|
| 236 |
+
|
| 237 |
+
|
| 238 |
logo_image_path = os.path.abspath("assets/logo.png")
|
| 239 |
|
| 240 |
demo = gr.Blocks(css=custom_css, theme=gr.themes.Soft())
|
|
|
|
| 321 |
submit_button = gr.Button("Submit CSV", variant="primary")
|
| 322 |
submission_result = gr.Markdown()
|
| 323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
with gr.Accordion("📊 Submission History", open=False):
|
| 325 |
with gr.Tabs():
|
| 326 |
with gr.TabItem("✅ Accepted Submissions"):
|
|
|
|
| 342 |
row_count=10,
|
| 343 |
)
|
| 344 |
|
| 345 |
+
submit_button.click(
|
| 346 |
+
submit_csv_ui,
|
| 347 |
+
[token_input, csv_file_input],
|
| 348 |
+
[submission_result, leaderboard, accepted_table, rejected_table, all_table],
|
| 349 |
+
)
|
| 350 |
+
|
| 351 |
+
demo.load(
|
| 352 |
+
lambda: (refresh_leaderboard(), *refresh_submission_history()),
|
| 353 |
+
outputs=[leaderboard, accepted_table, rejected_table, all_table],
|
| 354 |
+
)
|
| 355 |
|
| 356 |
if __name__ == "__main__":
|
| 357 |
scheduler = BackgroundScheduler()
|
src/about.py
CHANGED
|
@@ -13,7 +13,7 @@ LLM_BENCHMARKS_TEXT = """
|
|
| 13 |
- **Save your token** - you'll need it to submit predictions and you won't be able to see your token again after registration
|
| 14 |
|
| 15 |
### 2. Exploratory Notebook
|
| 16 |
-
To get you started quickly, we have prepared an [Exploratory Notebook](https://colab.research.google.com/drive/
|
| 17 |
|
| 18 |
Feel free to use your computer instead of Google Colab to run the notebook
|
| 19 |
|
|
|
|
| 13 |
- **Save your token** - you'll need it to submit predictions and you won't be able to see your token again after registration
|
| 14 |
|
| 15 |
### 2. Exploratory Notebook
|
| 16 |
+
To get you started quickly, we have prepared an [Exploratory Notebook](https://colab.research.google.com/drive/1cGQ5fMrNM7-YEmPTudIgN9OlA1-v0wEC)
|
| 17 |
|
| 18 |
Feel free to use your computer instead of Google Colab to run the notebook
|
| 19 |
|