Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
79359ac
1
Parent(s):
727eb6f
fixed caching issue
Browse files
app.py
CHANGED
@@ -8,6 +8,14 @@ from dabstep_benchmark.leaderboard import *
|
|
8 |
|
9 |
def restart_space():
|
10 |
HF_API.restart_space(repo_id=HF_LEADERBOARD)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
|
13 |
if __name__ == "__main__":
|
@@ -19,16 +27,12 @@ if __name__ == "__main__":
|
|
19 |
gr.Markdown(TITLE)
|
20 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
21 |
|
22 |
-
# Generate leaderboard data
|
23 |
-
|
24 |
-
|
25 |
-
# Filter validated and unvalidated
|
26 |
-
validated = leaderboard_df[leaderboard_df["validated"] == True].drop(columns=["validated"]).copy()
|
27 |
-
unvalidated = leaderboard_df[leaderboard_df["validated"] == False].drop(columns=["validated"]).copy()
|
28 |
|
29 |
|
30 |
with gr.Tab("Validated"):
|
31 |
-
|
32 |
value=validated,
|
33 |
datatype=["markdown", "str", "str", "str", "markdown", "str", "str", "str"],
|
34 |
interactive=False,
|
@@ -37,7 +41,7 @@ if __name__ == "__main__":
|
|
37 |
)
|
38 |
|
39 |
with gr.Tab("Unvalidated"):
|
40 |
-
|
41 |
value=unvalidated,
|
42 |
datatype=["markdown", "str", "str", "str", "markdown", "str", "str", "str"],
|
43 |
interactive=False,
|
@@ -45,7 +49,7 @@ if __name__ == "__main__":
|
|
45 |
wrap=True,
|
46 |
)
|
47 |
# create a Gradio event listener that runs when the page is loaded to populate the dataframe
|
48 |
-
demo.load(
|
49 |
|
50 |
refresh_button = gr.Button("Refresh")
|
51 |
refresh_button.click(
|
@@ -54,7 +58,7 @@ if __name__ == "__main__":
|
|
54 |
gr.Checkbox(value=True, visible=False)
|
55 |
],
|
56 |
outputs=[
|
57 |
-
|
58 |
],
|
59 |
)
|
60 |
with gr.Row():
|
|
|
8 |
|
9 |
def restart_space():
|
10 |
HF_API.restart_space(repo_id=HF_LEADERBOARD)
|
11 |
+
|
12 |
+
# Helper function to update both tables
|
13 |
+
def update_tables():
|
14 |
+
leaderboard_df = generate_leaderboard_df()
|
15 |
+
validated = leaderboard_df[leaderboard_df["validated"] == True].drop(columns=["validated"])
|
16 |
+
unvalidated = leaderboard_df[leaderboard_df["validated"] == False].drop(columns=["validated"])
|
17 |
+
return validated, unvalidated
|
18 |
+
|
19 |
|
20 |
|
21 |
if __name__ == "__main__":
|
|
|
27 |
gr.Markdown(TITLE)
|
28 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
29 |
|
30 |
+
# Generate initial leaderboard data
|
31 |
+
validated, unvalidated = update_tables()
|
|
|
|
|
|
|
|
|
32 |
|
33 |
|
34 |
with gr.Tab("Validated"):
|
35 |
+
verified_table = gr.Dataframe(
|
36 |
value=validated,
|
37 |
datatype=["markdown", "str", "str", "str", "markdown", "str", "str", "str"],
|
38 |
interactive=False,
|
|
|
41 |
)
|
42 |
|
43 |
with gr.Tab("Unvalidated"):
|
44 |
+
unverified_table = gr.Dataframe(
|
45 |
value=unvalidated,
|
46 |
datatype=["markdown", "str", "str", "str", "markdown", "str", "str", "str"],
|
47 |
interactive=False,
|
|
|
49 |
wrap=True,
|
50 |
)
|
51 |
# create a Gradio event listener that runs when the page is loaded to populate the dataframe
|
52 |
+
demo.load(update_tables, inputs=None, outputs=[verified_table, unverified_table])
|
53 |
|
54 |
refresh_button = gr.Button("Refresh")
|
55 |
refresh_button.click(
|
|
|
58 |
gr.Checkbox(value=True, visible=False)
|
59 |
],
|
60 |
outputs=[
|
61 |
+
verified_table, unverified_table
|
62 |
],
|
63 |
)
|
64 |
with gr.Row():
|