Jimin Huang
commited on
Commit
•
670a324
1
Parent(s):
4e774c6
feat: modify leaderboard
Browse files- .pre-commit-config.yaml +0 -53
- app.py +144 -338
.pre-commit-config.yaml
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
2 |
-
#
|
3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
-
# you may not use this file except in compliance with the License.
|
5 |
-
# You may obtain a copy of the License at
|
6 |
-
#
|
7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
-
#
|
9 |
-
# Unless required by applicable law or agreed to in writing, software
|
10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
-
# See the License for the specific language governing permissions and
|
13 |
-
# limitations under the License.
|
14 |
-
|
15 |
-
default_language_version:
|
16 |
-
python: python3
|
17 |
-
|
18 |
-
ci:
|
19 |
-
autofix_prs: true
|
20 |
-
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
|
21 |
-
autoupdate_schedule: quarterly
|
22 |
-
|
23 |
-
repos:
|
24 |
-
- repo: https://github.com/pre-commit/pre-commit-hooks
|
25 |
-
rev: v4.3.0
|
26 |
-
hooks:
|
27 |
-
- id: check-yaml
|
28 |
-
- id: check-case-conflict
|
29 |
-
- id: detect-private-key
|
30 |
-
- id: check-added-large-files
|
31 |
-
args: ['--maxkb=1000']
|
32 |
-
- id: requirements-txt-fixer
|
33 |
-
- id: end-of-file-fixer
|
34 |
-
- id: trailing-whitespace
|
35 |
-
|
36 |
-
- repo: https://github.com/PyCQA/isort
|
37 |
-
rev: 5.12.0
|
38 |
-
hooks:
|
39 |
-
- id: isort
|
40 |
-
name: Format imports
|
41 |
-
|
42 |
-
- repo: https://github.com/psf/black
|
43 |
-
rev: 22.12.0
|
44 |
-
hooks:
|
45 |
-
- id: black
|
46 |
-
name: Format code
|
47 |
-
additional_dependencies: ['click==8.0.2']
|
48 |
-
|
49 |
-
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
50 |
-
# Ruff version.
|
51 |
-
rev: 'v0.0.267'
|
52 |
-
hooks:
|
53 |
-
- id: ruff
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
@@ -1,345 +1,151 @@
|
|
1 |
-
|
2 |
import gradio as gr
|
|
|
|
|
3 |
import pandas as pd
|
4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
)
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
)
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
)
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
)
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
(
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
def
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
):
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
filtered_df = df[
|
90 |
-
always_here_cols + [c for c in COLS if c in df.columns and c in columns]
|
91 |
-
]
|
92 |
-
return filtered_df
|
93 |
-
|
94 |
-
|
95 |
-
def filter_queries(query: str, filtered_df: pd.DataFrame) -> pd.DataFrame:
|
96 |
-
final_df = []
|
97 |
-
if query != "":
|
98 |
-
queries = [q.strip() for q in query.split(";")]
|
99 |
-
for _q in queries:
|
100 |
-
_q = _q.strip()
|
101 |
-
if _q != "":
|
102 |
-
temp_filtered_df = search_table(filtered_df, _q)
|
103 |
-
if len(temp_filtered_df) > 0:
|
104 |
-
final_df.append(temp_filtered_df)
|
105 |
-
if len(final_df) > 0:
|
106 |
-
filtered_df = pd.concat(final_df)
|
107 |
-
filtered_df = filtered_df.drop_duplicates(
|
108 |
-
subset=[AutoEvalColumn.model.name, AutoEvalColumn.precision.name, AutoEvalColumn.revision.name]
|
109 |
-
)
|
110 |
-
|
111 |
-
return filtered_df
|
112 |
-
|
113 |
-
|
114 |
-
def filter_models(
|
115 |
-
df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, show_deleted: bool
|
116 |
-
) -> pd.DataFrame:
|
117 |
-
# Show all models
|
118 |
-
if show_deleted:
|
119 |
-
filtered_df = df
|
120 |
-
else: # Show only still on the hub models
|
121 |
-
filtered_df = df[df[AutoEvalColumn.still_on_hub.name] == True]
|
122 |
-
|
123 |
-
type_emoji = [t[0] for t in type_query]
|
124 |
-
filtered_df = filtered_df.loc[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
|
125 |
-
filtered_df = filtered_df.loc[df[AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
|
126 |
-
|
127 |
-
numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query]))
|
128 |
-
params_column = pd.to_numeric(df[AutoEvalColumn.params.name], errors="coerce")
|
129 |
-
mask = params_column.apply(lambda x: any(numeric_interval.contains(x)))
|
130 |
-
filtered_df = filtered_df.loc[mask]
|
131 |
-
|
132 |
-
return filtered_df
|
133 |
-
|
134 |
-
|
135 |
-
demo = gr.Blocks(css=custom_css)
|
136 |
-
with demo:
|
137 |
-
gr.HTML(TITLE)
|
138 |
-
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
139 |
-
|
140 |
-
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
141 |
-
with gr.TabItem("🏅 LLM Benchmark", elem_id="llm-benchmark-tab-table", id=0):
|
142 |
-
with gr.Row():
|
143 |
-
with gr.Column():
|
144 |
-
with gr.Row():
|
145 |
-
search_bar = gr.Textbox(
|
146 |
-
placeholder=" 🔍 Search for your model (separate multiple queries with `;`) and press ENTER...",
|
147 |
-
show_label=False,
|
148 |
-
elem_id="search-bar",
|
149 |
-
)
|
150 |
-
with gr.Row():
|
151 |
-
shown_columns = gr.CheckboxGroup(
|
152 |
-
choices=[
|
153 |
-
c.name
|
154 |
-
for c in fields(AutoEvalColumn)
|
155 |
-
if not c.hidden and not c.never_hidden
|
156 |
-
],
|
157 |
-
value=[
|
158 |
-
c.name
|
159 |
-
for c in fields(AutoEvalColumn)
|
160 |
-
if c.displayed_by_default and not c.hidden and not c.never_hidden
|
161 |
-
],
|
162 |
-
label="Select columns to show",
|
163 |
-
elem_id="column-select",
|
164 |
-
interactive=True,
|
165 |
-
)
|
166 |
-
with gr.Row():
|
167 |
-
deleted_models_visibility = gr.Checkbox(
|
168 |
-
value=False, label="Show gated/private/deleted models", interactive=True
|
169 |
-
)
|
170 |
-
with gr.Column(min_width=320):
|
171 |
-
#with gr.Box(elem_id="box-filter"):
|
172 |
-
filter_columns_type = gr.CheckboxGroup(
|
173 |
-
label="Model types",
|
174 |
-
choices=[t.to_str() for t in ModelType],
|
175 |
-
value=[t.to_str() for t in ModelType],
|
176 |
-
interactive=True,
|
177 |
-
elem_id="filter-columns-type",
|
178 |
-
)
|
179 |
-
filter_columns_precision = gr.CheckboxGroup(
|
180 |
-
label="Precision",
|
181 |
-
choices=[i.value.name for i in Precision],
|
182 |
-
value=[i.value.name for i in Precision],
|
183 |
-
interactive=True,
|
184 |
-
elem_id="filter-columns-precision",
|
185 |
-
)
|
186 |
-
filter_columns_size = gr.CheckboxGroup(
|
187 |
-
label="Model sizes (in billions of parameters)",
|
188 |
-
choices=list(NUMERIC_INTERVALS.keys()),
|
189 |
-
value=list(NUMERIC_INTERVALS.keys()),
|
190 |
-
interactive=True,
|
191 |
-
elem_id="filter-columns-size",
|
192 |
-
)
|
193 |
-
|
194 |
-
leaderboard_table = gr.components.Dataframe(
|
195 |
-
value=leaderboard_df[
|
196 |
-
[c.name for c in fields(AutoEvalColumn) if c.never_hidden]
|
197 |
-
+ shown_columns.value
|
198 |
-
],
|
199 |
-
headers=[c.name for c in fields(AutoEvalColumn) if c.never_hidden] + shown_columns.value,
|
200 |
-
datatype=TYPES,
|
201 |
-
elem_id="leaderboard-table",
|
202 |
-
interactive=False,
|
203 |
-
visible=True,
|
204 |
-
)
|
205 |
-
|
206 |
-
# Dummy leaderboard for handling the case when the user uses backspace key
|
207 |
-
hidden_leaderboard_table_for_search = gr.components.Dataframe(
|
208 |
-
value=original_df[COLS],
|
209 |
-
headers=COLS,
|
210 |
-
datatype=TYPES,
|
211 |
-
visible=False,
|
212 |
-
)
|
213 |
-
search_bar.submit(
|
214 |
-
update_table,
|
215 |
-
[
|
216 |
-
hidden_leaderboard_table_for_search,
|
217 |
-
shown_columns,
|
218 |
-
filter_columns_type,
|
219 |
-
filter_columns_precision,
|
220 |
-
filter_columns_size,
|
221 |
-
deleted_models_visibility,
|
222 |
-
search_bar,
|
223 |
-
],
|
224 |
-
leaderboard_table,
|
225 |
-
)
|
226 |
-
for selector in [shown_columns, filter_columns_type, filter_columns_precision, filter_columns_size, deleted_models_visibility]:
|
227 |
-
selector.change(
|
228 |
-
update_table,
|
229 |
-
[
|
230 |
-
hidden_leaderboard_table_for_search,
|
231 |
-
shown_columns,
|
232 |
-
filter_columns_type,
|
233 |
-
filter_columns_precision,
|
234 |
-
filter_columns_size,
|
235 |
-
deleted_models_visibility,
|
236 |
-
search_bar,
|
237 |
-
],
|
238 |
-
leaderboard_table,
|
239 |
-
queue=True,
|
240 |
-
)
|
241 |
-
|
242 |
-
with gr.TabItem("📝 About", elem_id="llm-benchmark-tab-table", id=2):
|
243 |
-
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
|
244 |
-
|
245 |
-
with gr.TabItem("🚀 Submit here! ", elem_id="llm-benchmark-tab-table", id=3):
|
246 |
-
with gr.Column():
|
247 |
-
with gr.Row():
|
248 |
-
gr.Markdown(EVALUATION_QUEUE_TEXT, elem_classes="markdown-text")
|
249 |
-
|
250 |
-
with gr.Column():
|
251 |
-
with gr.Accordion(
|
252 |
-
f"✅ Finished Evaluations ({len(finished_eval_queue_df)})",
|
253 |
-
open=False,
|
254 |
-
):
|
255 |
-
with gr.Row():
|
256 |
-
finished_eval_table = gr.components.Dataframe(
|
257 |
-
value=finished_eval_queue_df,
|
258 |
-
headers=EVAL_COLS,
|
259 |
-
datatype=EVAL_TYPES,
|
260 |
-
row_count=5,
|
261 |
-
)
|
262 |
-
with gr.Accordion(
|
263 |
-
f"🔄 Running Evaluation Queue ({len(running_eval_queue_df)})",
|
264 |
-
open=False,
|
265 |
-
):
|
266 |
-
with gr.Row():
|
267 |
-
running_eval_table = gr.components.Dataframe(
|
268 |
-
value=running_eval_queue_df,
|
269 |
-
headers=EVAL_COLS,
|
270 |
-
datatype=EVAL_TYPES,
|
271 |
-
row_count=5,
|
272 |
-
)
|
273 |
-
|
274 |
-
with gr.Accordion(
|
275 |
-
f"⏳ Pending Evaluation Queue ({len(pending_eval_queue_df)})",
|
276 |
-
open=False,
|
277 |
-
):
|
278 |
-
with gr.Row():
|
279 |
-
pending_eval_table = gr.components.Dataframe(
|
280 |
-
value=pending_eval_queue_df,
|
281 |
-
headers=EVAL_COLS,
|
282 |
-
datatype=EVAL_TYPES,
|
283 |
-
row_count=5,
|
284 |
-
)
|
285 |
-
with gr.Row():
|
286 |
-
gr.Markdown("# ✉️✨ Submit your model here!", elem_classes="markdown-text")
|
287 |
-
|
288 |
-
with gr.Row():
|
289 |
-
with gr.Column():
|
290 |
-
model_name_textbox = gr.Textbox(label="Model name")
|
291 |
-
revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")
|
292 |
-
model_type = gr.Dropdown(
|
293 |
-
choices=[t.to_str(" : ") for t in ModelType if t != ModelType.Unknown],
|
294 |
-
label="Model type",
|
295 |
-
multiselect=False,
|
296 |
-
value=None,
|
297 |
-
interactive=True,
|
298 |
-
)
|
299 |
-
|
300 |
-
with gr.Column():
|
301 |
-
precision = gr.Dropdown(
|
302 |
-
choices=[i.value.name for i in Precision if i != Precision.Unknown],
|
303 |
-
label="Precision",
|
304 |
-
multiselect=False,
|
305 |
-
value="float16",
|
306 |
-
interactive=True,
|
307 |
-
)
|
308 |
-
weight_type = gr.Dropdown(
|
309 |
-
choices=[i.value.name for i in WeightType],
|
310 |
-
label="Weights type",
|
311 |
-
multiselect=False,
|
312 |
-
value="Original",
|
313 |
-
interactive=True,
|
314 |
-
)
|
315 |
-
base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")
|
316 |
-
|
317 |
-
submit_button = gr.Button("Submit Eval")
|
318 |
-
submission_result = gr.Markdown()
|
319 |
-
submit_button.click(
|
320 |
-
add_new_eval,
|
321 |
-
[
|
322 |
-
model_name_textbox,
|
323 |
-
base_model_name_textbox,
|
324 |
-
revision_name_textbox,
|
325 |
-
precision,
|
326 |
-
weight_type,
|
327 |
-
model_type,
|
328 |
-
],
|
329 |
-
submission_result,
|
330 |
-
)
|
331 |
-
|
332 |
-
with gr.Row():
|
333 |
-
with gr.Accordion("📙 Citation", open=False):
|
334 |
-
citation_button = gr.Textbox(
|
335 |
-
value=CITATION_BUTTON_TEXT,
|
336 |
-
label=CITATION_BUTTON_LABEL,
|
337 |
-
lines=20,
|
338 |
-
elem_id="citation-button",
|
339 |
-
show_copy_button=True,
|
340 |
-
)
|
341 |
|
342 |
scheduler = BackgroundScheduler()
|
343 |
-
scheduler.add_job(
|
344 |
scheduler.start()
|
345 |
-
|
|
|
|
|
|
1 |
+
# matplotlib.use('macosx')
|
2 |
import gradio as gr
|
3 |
+
import matplotlib
|
4 |
+
import numpy as np
|
5 |
import pandas as pd
|
6 |
from apscheduler.schedulers.background import BackgroundScheduler
|
7 |
+
|
8 |
+
TASK1_COLS = [
|
9 |
+
("Model", "str"),
|
10 |
+
("Acc", "number"),
|
11 |
+
("F1", "number"),
|
12 |
+
("MCC", "number"),
|
13 |
+
]
|
14 |
+
|
15 |
+
TASK2_COLS = [
|
16 |
+
("Model", "str"),
|
17 |
+
("Rouge-1", "number"),
|
18 |
+
("Rouge-2", "number"),
|
19 |
+
("Rouge-L", "number"),
|
20 |
+
("BertScore", "number"),
|
21 |
+
("BartScore", "number"),
|
22 |
+
]
|
23 |
+
|
24 |
+
TASK3_COLS = [
|
25 |
+
("Model", "str"),
|
26 |
+
("Sharpe Ratio", "number"),
|
27 |
+
("Sharpe Ratio - DRIV", "number"),
|
28 |
+
("Sharpe Ratio - FORM", "number"),
|
29 |
+
("Sharpe Ratio - JNJ", "number"),
|
30 |
+
("Sharpe Ratio - MSFT", "number"),
|
31 |
+
]
|
32 |
+
|
33 |
+
|
34 |
+
# Extract column names
|
35 |
+
task1_cols = [col_name for col_name, _ in TASK1_COLS]
|
36 |
+
task2_cols = [col_name for col_name, _ in TASK2_COLS]
|
37 |
+
task3_cols = [col_name for col_name, _ in TASK3_COLS]
|
38 |
+
|
39 |
+
|
40 |
+
def create_df_dict(lang, lang_cols):
|
41 |
+
# Load leaderboard data with column names
|
42 |
+
leaderboard_df = pd.read_csv(f"{lang}_result.csv", names=lang_cols)
|
43 |
+
leaderboard_df = leaderboard_df.sort_index(axis=1)
|
44 |
+
# Move 'key' column to the front
|
45 |
+
leaderboard_df = leaderboard_df[["Model"] + [col for col in leaderboard_df.columns if col != "Model"]]
|
46 |
+
cols = leaderboard_df.columns
|
47 |
+
types = ["str"] + ["number"] * (len(lang_cols) - 1)
|
48 |
+
|
49 |
+
# Split merged_df into subtask dataframes
|
50 |
+
df_dict = {"overall": leaderboard_df}
|
51 |
+
return df_dict
|
52 |
+
|
53 |
+
|
54 |
+
df_lang = {
|
55 |
+
"Task 1": create_df_dict("task1", task1_cols),
|
56 |
+
"Task 2": create_df_dict("task2", task2_cols),
|
57 |
+
"Task 3": create_df_dict("task3", task3_cols),
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
# Constants
|
62 |
+
TITLE = '<h1 align="center" id="space-title">🐲 IJCAI 2024 FinLLM Challenge Leaderboard</h1>'
|
63 |
+
INTRODUCTION_TEXT = """📊 Introduction
|
64 |
+
|
65 |
+
The FinLLM Challenge rigorously evaluates state-of-the-art models in financial text analysis, generation, and decision-making tasks. These tasks include financial classification, financial text summarization, and single stock trading.
|
66 |
+
|
67 |
+
📈 Unique Evaluation Metrics
|
68 |
+
|
69 |
+
Our leaderboard incorporates a comprehensive evaluation using diverse metrics like Accuracy, F1 Score, ROUGE, BERTScore, and Sharpe Ratio to assess the models' capabilities in real-world financial applications.
|
70 |
+
|
71 |
+
📚 Task Details
|
72 |
+
|
73 |
+
**Task 1: Financial Classification**
|
74 |
+
|
75 |
+
- **Objective:** Classify sentences as claims or premises.
|
76 |
+
- **Dataset:** 7.75k training data, 969 test data.
|
77 |
+
- **Evaluation Metrics:** F1 Score (final ranking metric) and Accuracy.
|
78 |
+
|
79 |
+
**Task 2: Financial Text Summarization**
|
80 |
+
|
81 |
+
- **Objective:** Summarize financial news articles into concise texts.
|
82 |
+
- **Dataset:** 8k training data, 2k test data.
|
83 |
+
- **Evaluation Metrics:** ROUGE (1, 2, L) and BERTScore (ROUGE-1 as the final ranking metric).
|
84 |
+
|
85 |
+
**Task 3: Single Stock Trading**
|
86 |
+
|
87 |
+
- **Objective:** Make stock trading decisions (buy, sell, hold) with reasonings.
|
88 |
+
- **Dataset:** 291 data points.
|
89 |
+
- **Evaluation Metrics:** Sharpe Ratio (final ranking metric), Cumulative Return, Daily and Annualized Volatility, Maximum Drawdown.
|
90 |
+
|
91 |
+
For more details, refer to our [Challenge page](https://sites.google.com/nlg.csie.ntu.edu.tw/finnlp-agentscen/shared-task-finllm?authuser=0).
|
92 |
+
"""
|
93 |
+
|
94 |
+
|
95 |
+
def create_data_interface(df):
|
96 |
+
headers = df.columns
|
97 |
+
types = ["str"] + ["number"] * (len(headers) - 1)
|
98 |
+
|
99 |
+
return gr.components.Dataframe(
|
100 |
+
value=df.values.tolist(),
|
101 |
+
headers=[col_name for col_name in headers],
|
102 |
+
datatype=types,
|
103 |
+
max_rows=10,
|
104 |
)
|
105 |
+
|
106 |
+
|
107 |
+
def plot_radar_chart(df, attributes, category_name):
|
108 |
+
fig = go.Figure()
|
109 |
+
|
110 |
+
for index, row in df.iterrows():
|
111 |
+
model = row["Model"]
|
112 |
+
values = row[attributes].tolist()
|
113 |
+
fig.add_trace(go.Scatterpolar(r=values, theta=attributes, fill="toself", name=model))
|
114 |
+
|
115 |
+
fig.update_layout(title="FLARE", polar=dict(radialaxis=dict(visible=True, range=[0, 0.9])), showlegend=True)
|
116 |
+
|
117 |
+
return fig
|
118 |
+
|
119 |
+
|
120 |
+
def create_data_interface_for_aggregated(df, category_name):
|
121 |
+
attributes = df.columns[1:]
|
122 |
+
print(attributes)
|
123 |
+
plt = plot_radar_chart(df, attributes, category_name)
|
124 |
+
return plt
|
125 |
+
|
126 |
+
|
127 |
+
def create_lang_leaderboard(df_dict):
|
128 |
+
for key, df in df_dict.items():
|
129 |
+
with gr.Tab(key):
|
130 |
+
create_data_interface(df)
|
131 |
+
|
132 |
+
|
133 |
+
def launch_gradio():
|
134 |
+
demo = gr.Blocks()
|
135 |
+
|
136 |
+
with demo:
|
137 |
+
gr.HTML(TITLE)
|
138 |
+
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
139 |
+
for key, df_dict in df_lang.items():
|
140 |
+
with gr.Tab(key):
|
141 |
+
create_lang_leaderboard(df_dict)
|
142 |
+
|
143 |
+
demo.launch()
|
144 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
|
146 |
scheduler = BackgroundScheduler()
|
147 |
+
scheduler.add_job(launch_gradio, "interval", seconds=3600)
|
148 |
scheduler.start()
|
149 |
+
|
150 |
+
# Launch immediately
|
151 |
+
launch_gradio()
|