update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
|
3 |
import pandas as pd
|
@@ -24,7 +26,6 @@ from src.display.utils import (
|
|
24 |
Precision
|
25 |
)
|
26 |
|
27 |
-
|
28 |
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO, TOKEN
|
29 |
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
30 |
from src.submission.submit import add_new_eval
|
@@ -50,6 +51,8 @@ except Exception:
|
|
50 |
|
51 |
|
52 |
LEADERBOARD_DF = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
|
|
|
|
53 |
|
54 |
(
|
55 |
finished_eval_queue_df,
|
@@ -67,11 +70,19 @@ with demo:
|
|
67 |
if LEADERBOARD_DF.empty:
|
68 |
gr.Markdown("No evaluations have been performed yet. The leaderboard is currently empty.")
|
69 |
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
leaderboard = Leaderboard(
|
71 |
value=LEADERBOARD_DF,
|
72 |
datatype=[col.type for col in COLUMNS],
|
73 |
select_columns=SelectColumns(
|
74 |
-
default_selection=
|
75 |
cant_deselect=[col.name for col in COLUMNS if col.never_hidden],
|
76 |
label="Select Columns to Display:",
|
77 |
),
|
@@ -116,11 +127,12 @@ with demo:
|
|
116 |
value=None,
|
117 |
interactive=True,
|
118 |
)
|
119 |
-
num_examples_input
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
|
|
124 |
|
125 |
with gr.Column():
|
126 |
precision = gr.Dropdown(
|
@@ -150,7 +162,7 @@ with demo:
|
|
150 |
precision,
|
151 |
weight_type,
|
152 |
model_type,
|
153 |
-
num_examples_input
|
154 |
],
|
155 |
submission_result,
|
156 |
)
|
@@ -168,4 +180,4 @@ with demo:
|
|
168 |
scheduler = BackgroundScheduler()
|
169 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
170 |
scheduler.start()
|
171 |
-
demo.queue(default_concurrency_limit=40).launch()
|
|
|
1 |
+
# app.py
|
2 |
+
|
3 |
import gradio as gr
|
4 |
from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
|
5 |
import pandas as pd
|
|
|
26 |
Precision
|
27 |
)
|
28 |
|
|
|
29 |
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO, TOKEN
|
30 |
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
31 |
from src.submission.submit import add_new_eval
|
|
|
51 |
|
52 |
|
53 |
LEADERBOARD_DF = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
54 |
+
print("LEADERBOARD_DF Shape:", LEADERBOARD_DF.shape) # Debug
|
55 |
+
print("LEADERBOARD_DF Columns:", LEADERBOARD_DF.columns.tolist()) # Debug
|
56 |
|
57 |
(
|
58 |
finished_eval_queue_df,
|
|
|
70 |
if LEADERBOARD_DF.empty:
|
71 |
gr.Markdown("No evaluations have been performed yet. The leaderboard is currently empty.")
|
72 |
else:
|
73 |
+
default_selection = [col.name for col in COLUMNS if col.displayed_by_default]
|
74 |
+
print("Default Selection before ensuring 'model':", default_selection) # Debug
|
75 |
+
|
76 |
+
# Ensure "model" is included
|
77 |
+
if "model" not in default_selection:
|
78 |
+
default_selection.insert(0, "model")
|
79 |
+
print("Default Selection after ensuring 'model':", default_selection) # Debug
|
80 |
+
|
81 |
leaderboard = Leaderboard(
|
82 |
value=LEADERBOARD_DF,
|
83 |
datatype=[col.type for col in COLUMNS],
|
84 |
select_columns=SelectColumns(
|
85 |
+
default_selection=default_selection,
|
86 |
cant_deselect=[col.name for col in COLUMNS if col.never_hidden],
|
87 |
label="Select Columns to Display:",
|
88 |
),
|
|
|
127 |
value=None,
|
128 |
interactive=True,
|
129 |
)
|
130 |
+
# Removed num_examples_input since we're using a fixed number
|
131 |
+
# num_examples_input = gr.Number(
|
132 |
+
# label="Number of Examples per Subject (e.g., 10)",
|
133 |
+
# value=10,
|
134 |
+
# precision=0
|
135 |
+
# )
|
136 |
|
137 |
with gr.Column():
|
138 |
precision = gr.Dropdown(
|
|
|
162 |
precision,
|
163 |
weight_type,
|
164 |
model_type,
|
165 |
+
# num_examples_input # Removed
|
166 |
],
|
167 |
submission_result,
|
168 |
)
|
|
|
180 |
scheduler = BackgroundScheduler()
|
181 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
182 |
scheduler.start()
|
183 |
+
demo.queue(default_concurrency_limit=40).launch()
|