Update app.py
Browse files
app.py
CHANGED
|
@@ -257,16 +257,15 @@ def load_leaderboard():
|
|
| 257 |
return pd.DataFrame({"Message": ["Leaderboard is empty."]})
|
| 258 |
print("Loading leaderboard data...")
|
| 259 |
return pd.read_csv(LEADERBOARD_FILE)
|
| 260 |
-
|
| 261 |
def evaluate_predictions_and_update_leaderboard(prediction_file):
|
| 262 |
"""
|
| 263 |
Evaluate predictions and update the leaderboard.
|
| 264 |
"""
|
| 265 |
ground_truth_file = "ground_truth.csv"
|
| 266 |
if not os.path.exists(ground_truth_file):
|
| 267 |
-
return "Ground truth file not found.",
|
| 268 |
if not prediction_file:
|
| 269 |
-
return "Prediction file not uploaded.",
|
| 270 |
|
| 271 |
try:
|
| 272 |
predictions_df = pd.read_csv(prediction_file.name)
|
|
@@ -306,7 +305,7 @@ with gr.Blocks() as demo:
|
|
| 306 |
with gr.TabItem("🏅 Submission"):
|
| 307 |
file_input = gr.File(label="Upload Prediction CSV")
|
| 308 |
eval_status = gr.Textbox(label="Evaluation Status", interactive=False)
|
| 309 |
-
|
| 310 |
value=load_leaderboard(),
|
| 311 |
label="Leaderboard (Preview)",
|
| 312 |
interactive=False,
|
|
@@ -316,7 +315,7 @@ with gr.Blocks() as demo:
|
|
| 316 |
eval_button.click(
|
| 317 |
evaluate_predictions_and_update_leaderboard,
|
| 318 |
inputs=[file_input],
|
| 319 |
-
outputs=[eval_status,
|
| 320 |
)
|
| 321 |
|
| 322 |
# Leaderboard Tab
|
|
|
|
| 257 |
return pd.DataFrame({"Message": ["Leaderboard is empty."]})
|
| 258 |
print("Loading leaderboard data...")
|
| 259 |
return pd.read_csv(LEADERBOARD_FILE)
|
|
|
|
| 260 |
def evaluate_predictions_and_update_leaderboard(prediction_file):
|
| 261 |
"""
|
| 262 |
Evaluate predictions and update the leaderboard.
|
| 263 |
"""
|
| 264 |
ground_truth_file = "ground_truth.csv"
|
| 265 |
if not os.path.exists(ground_truth_file):
|
| 266 |
+
return "Ground truth file not found.", load_leaderboard()
|
| 267 |
if not prediction_file:
|
| 268 |
+
return "Prediction file not uploaded.", load_leaderboard()
|
| 269 |
|
| 270 |
try:
|
| 271 |
predictions_df = pd.read_csv(prediction_file.name)
|
|
|
|
| 305 |
with gr.TabItem("🏅 Submission"):
|
| 306 |
file_input = gr.File(label="Upload Prediction CSV")
|
| 307 |
eval_status = gr.Textbox(label="Evaluation Status", interactive=False)
|
| 308 |
+
leaderboard_table_preview = gr.Dataframe(
|
| 309 |
value=load_leaderboard(),
|
| 310 |
label="Leaderboard (Preview)",
|
| 311 |
interactive=False,
|
|
|
|
| 315 |
eval_button.click(
|
| 316 |
evaluate_predictions_and_update_leaderboard,
|
| 317 |
inputs=[file_input],
|
| 318 |
+
outputs=[eval_status, leaderboard_table_preview],
|
| 319 |
)
|
| 320 |
|
| 321 |
# Leaderboard Tab
|