Spaces:
Sleeping
Sleeping
Sebastian Deatc
commited on
update
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
|
|
3 |
import pandas as pd
|
4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
5 |
from huggingface_hub import snapshot_download
|
6 |
-
|
7 |
from src.about import (
|
8 |
CITATION_BUTTON_LABEL,
|
9 |
CITATION_BUTTON_TEXT,
|
@@ -32,30 +31,25 @@ from src.submission.submit import add_new_eval
|
|
32 |
def restart_space():
|
33 |
API.restart_space(repo_id=REPO_ID)
|
34 |
|
35 |
-
### Space
|
36 |
try:
|
37 |
-
print(EVAL_REQUESTS_PATH)
|
38 |
snapshot_download(
|
39 |
repo_id=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=TOKEN
|
40 |
)
|
41 |
except Exception:
|
42 |
restart_space()
|
43 |
try:
|
44 |
-
print(EVAL_RESULTS_PATH)
|
45 |
snapshot_download(
|
46 |
repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=TOKEN
|
47 |
)
|
48 |
except Exception:
|
49 |
restart_space()
|
50 |
|
51 |
-
|
52 |
LEADERBOARD_DF = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
running_eval_queue_df,
|
57 |
-
pending_eval_queue_df,
|
58 |
-
) = get_evaluation_queue_df(EVAL_REQUESTS_PATH, EVAL_COLS)
|
59 |
|
60 |
def init_leaderboard(dataframe):
|
61 |
if dataframe is None or dataframe.empty:
|
@@ -88,7 +82,7 @@ def init_leaderboard(dataframe):
|
|
88 |
interactive=False,
|
89 |
)
|
90 |
|
91 |
-
|
92 |
demo = gr.Blocks(css=custom_css)
|
93 |
with demo:
|
94 |
gr.HTML(TITLE)
|
@@ -96,7 +90,8 @@ with demo:
|
|
96 |
|
97 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
98 |
with gr.TabItem("🏅 LLM Benchmark", elem_id="llm-benchmark-tab-table", id=0):
|
99 |
-
leaderboard = init_leaderboard(LEADERBOARD_DF)
|
|
|
100 |
|
101 |
with gr.TabItem("📝 About", elem_id="llm-benchmark-tab-table", id=2):
|
102 |
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
|
@@ -201,4 +196,4 @@ with demo:
|
|
201 |
scheduler = BackgroundScheduler()
|
202 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
203 |
scheduler.start()
|
204 |
-
demo.queue(default_concurrency_limit=40).launch()
|
|
|
3 |
import pandas as pd
|
4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
5 |
from huggingface_hub import snapshot_download
|
|
|
6 |
from src.about import (
|
7 |
CITATION_BUTTON_LABEL,
|
8 |
CITATION_BUTTON_TEXT,
|
|
|
31 |
def restart_space():
|
32 |
API.restart_space(repo_id=REPO_ID)
|
33 |
|
34 |
+
### Space initialization
|
35 |
try:
|
|
|
36 |
snapshot_download(
|
37 |
repo_id=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=TOKEN
|
38 |
)
|
39 |
except Exception:
|
40 |
restart_space()
|
41 |
try:
|
|
|
42 |
snapshot_download(
|
43 |
repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=TOKEN
|
44 |
)
|
45 |
except Exception:
|
46 |
restart_space()
|
47 |
|
48 |
+
# Prepare your DataFrame
|
49 |
LEADERBOARD_DF = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
50 |
|
51 |
+
# Initialize DataFrames for evaluation queues
|
52 |
+
finished_eval_queue_df, running_eval_queue_df, pending_eval_queue_df = get_evaluation_queue_df(EVAL_REQUESTS_PATH, EVAL_COLS)
|
|
|
|
|
|
|
53 |
|
54 |
def init_leaderboard(dataframe):
|
55 |
if dataframe is None or dataframe.empty:
|
|
|
82 |
interactive=False,
|
83 |
)
|
84 |
|
85 |
+
# Start Gradio interface
|
86 |
demo = gr.Blocks(css=custom_css)
|
87 |
with demo:
|
88 |
gr.HTML(TITLE)
|
|
|
90 |
|
91 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
92 |
with gr.TabItem("🏅 LLM Benchmark", elem_id="llm-benchmark-tab-table", id=0):
|
93 |
+
leaderboard = init_leaderboard(LEADERBOARD_DF) # Use the prepared DataFrame
|
94 |
+
gr.Row().update(leaderboard) # Ensure the leaderboard is included
|
95 |
|
96 |
with gr.TabItem("📝 About", elem_id="llm-benchmark-tab-table", id=2):
|
97 |
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
|
|
|
196 |
scheduler = BackgroundScheduler()
|
197 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
198 |
scheduler.start()
|
199 |
+
demo.queue(default_concurrency_limit=40).launch()
|