Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ from src.assets.text_content import TITLE, INTRODUCTION_TEXT, CLEMSCORE_TEXT, MU
|
|
8 |
from src.leaderboard_utils import query_search, get_github_data
|
9 |
from src.plot_utils import split_models, plotly_plot, get_plot_df, update_open_models, update_closed_models
|
10 |
from src.plot_utils import reset_show_all, reset_show_names, reset_show_legend, reset_mobile_view
|
11 |
-
from src.version_utils import
|
12 |
from src.trend_utils import get_final_trend_plot
|
13 |
|
14 |
"""
|
@@ -16,8 +16,6 @@ CONSTANTS
|
|
16 |
"""
|
17 |
# For restarting the gradio application every 24 Hrs
|
18 |
TIME = 43200 # in seconds # Reload will not work locally - requires HFToken # The app launches locally as expected - only without the reload utility
|
19 |
-
# For Leaderboard table
|
20 |
-
dataframe_height = 800 # Height of the table in pixels # Set on average considering all possible devices
|
21 |
|
22 |
|
23 |
"""
|
@@ -34,29 +32,29 @@ def restart_space():
|
|
34 |
GITHUB UTILS
|
35 |
"""
|
36 |
github_data = get_github_data()
|
37 |
-
text_leaderboard = github_data["text"][0] # Get the text-only leaderboard
|
38 |
-
multimodal_leaderboard = github_data["multimodal"][0] # Get
|
39 |
|
40 |
# Show only First 4 columns for the leaderboards
|
|
|
41 |
text_leaderboard = text_leaderboard.iloc[:, :4]
|
42 |
-
print(f"Showing the following columns for the latest leaderboard: {text_leaderboard.columns}")
|
43 |
multimodal_leaderboard = multimodal_leaderboard.iloc[:, :4]
|
44 |
-
print(f"Showing the following columns for the multimodal leaderboard: {multimodal_leaderboard.columns}")
|
45 |
|
46 |
|
47 |
"""
|
48 |
VERSIONS UTILS
|
49 |
"""
|
50 |
-
versions_data =
|
51 |
-
latest_version = versions_data['
|
52 |
-
last_updated_date = versions_data['
|
53 |
-
version_names =
|
54 |
-
version_names = [v for v in version_names if v.startswith("v")] # Remove "latest" and "date" keys
|
55 |
|
56 |
global version_df
|
57 |
-
version_df = versions_data[
|
58 |
def select_version_df(name):
|
59 |
-
|
|
|
|
|
60 |
|
61 |
"""
|
62 |
MAIN APPLICATION
|
@@ -83,13 +81,12 @@ with hf_app:
|
|
83 |
value=text_leaderboard,
|
84 |
elem_id="text-leaderboard-table",
|
85 |
interactive=False,
|
86 |
-
visible=True
|
87 |
-
# height=dataframe_height
|
88 |
)
|
89 |
|
90 |
# Show information about the clemscore and last updated date below the table
|
91 |
gr.HTML(CLEMSCORE_TEXT)
|
92 |
-
gr.HTML(f"Last updated - {github_data['
|
93 |
|
94 |
# Add a dummy leaderboard to handle search queries in leaderboard_table
|
95 |
# This will show a temporary leaderboard based on the searched value
|
@@ -123,13 +120,12 @@ with hf_app:
|
|
123 |
value=multimodal_leaderboard,
|
124 |
elem_id="mm-leaderboard-table",
|
125 |
interactive=False,
|
126 |
-
visible=True
|
127 |
-
# height=dataframe_height
|
128 |
)
|
129 |
|
130 |
# Show information about the clemscore and last updated date below the table
|
131 |
gr.HTML(CLEMSCORE_TEXT)
|
132 |
-
gr.HTML(f"Last updated - {github_data['
|
133 |
|
134 |
# Add a dummy leaderboard to handle search queries in leaderboard_table
|
135 |
# This will show a temporary leaderboard based on the searched value
|
@@ -406,8 +402,7 @@ with hf_app:
|
|
406 |
value=version_df,
|
407 |
elem_id="version-leaderboard-table",
|
408 |
interactive=False,
|
409 |
-
visible=True
|
410 |
-
# height=dataframe_height
|
411 |
)
|
412 |
|
413 |
dummy_prev_table = gr.Dataframe(
|
|
|
8 |
from src.leaderboard_utils import query_search, get_github_data
|
9 |
from src.plot_utils import split_models, plotly_plot, get_plot_df, update_open_models, update_closed_models
|
10 |
from src.plot_utils import reset_show_all, reset_show_names, reset_show_legend, reset_mobile_view
|
11 |
+
from src.version_utils import get_version_data
|
12 |
from src.trend_utils import get_final_trend_plot
|
13 |
|
14 |
"""
|
|
|
16 |
"""
|
17 |
# For restarting the gradio application every 24 Hrs
|
18 |
TIME = 43200 # in seconds # Reload will not work locally - requires HFToken # The app launches locally as expected - only without the reload utility
|
|
|
|
|
19 |
|
20 |
|
21 |
"""
|
|
|
32 |
GITHUB UTILS
|
33 |
"""
|
34 |
github_data = get_github_data()
|
35 |
+
text_leaderboard = github_data["text"]["dataframes"][0] # Get the latest version of text-only leaderboard
|
36 |
+
multimodal_leaderboard = github_data["multimodal"]["dataframes"][0] # Get the latest version of multimodal leaderboard
|
37 |
|
38 |
# Show only First 4 columns for the leaderboards
|
39 |
+
# Should be Model Name, Clemscore, %Played, and Quality Score
|
40 |
text_leaderboard = text_leaderboard.iloc[:, :4]
|
|
|
41 |
multimodal_leaderboard = multimodal_leaderboard.iloc[:, :4]
|
|
|
42 |
|
43 |
|
44 |
"""
|
45 |
VERSIONS UTILS
|
46 |
"""
|
47 |
+
versions_data = get_version_data()
|
48 |
+
latest_version = versions_data['versions'][0]['name']
|
49 |
+
last_updated_date = versions_data['versions'][0]['last_updated'][0]
|
50 |
+
version_names = [v['name'] for v in versions_data['versions']]
|
|
|
51 |
|
52 |
global version_df
|
53 |
+
version_df = versions_data['dataframes'][0]
|
54 |
def select_version_df(name):
|
55 |
+
for i, v in enumerate(versions_data['versions']):
|
56 |
+
if v['name'] == name:
|
57 |
+
return versions_data['dataframes'][i]
|
58 |
|
59 |
"""
|
60 |
MAIN APPLICATION
|
|
|
81 |
value=text_leaderboard,
|
82 |
elem_id="text-leaderboard-table",
|
83 |
interactive=False,
|
84 |
+
visible=True
|
|
|
85 |
)
|
86 |
|
87 |
# Show information about the clemscore and last updated date below the table
|
88 |
gr.HTML(CLEMSCORE_TEXT)
|
89 |
+
gr.HTML(f"Last updated - {github_data['text']['version_data'][0]['last_updated'][0]}")
|
90 |
|
91 |
# Add a dummy leaderboard to handle search queries in leaderboard_table
|
92 |
# This will show a temporary leaderboard based on the searched value
|
|
|
120 |
value=multimodal_leaderboard,
|
121 |
elem_id="mm-leaderboard-table",
|
122 |
interactive=False,
|
123 |
+
visible=True
|
|
|
124 |
)
|
125 |
|
126 |
# Show information about the clemscore and last updated date below the table
|
127 |
gr.HTML(CLEMSCORE_TEXT)
|
128 |
+
gr.HTML(f"Last updated - {github_data['multimodal']['version_data'][0]['last_updated'][0]}")
|
129 |
|
130 |
# Add a dummy leaderboard to handle search queries in leaderboard_table
|
131 |
# This will show a temporary leaderboard based on the searched value
|
|
|
402 |
value=version_df,
|
403 |
elem_id="version-leaderboard-table",
|
404 |
interactive=False,
|
405 |
+
visible=True
|
|
|
406 |
)
|
407 |
|
408 |
dummy_prev_table = gr.Dataframe(
|