Spaces:
Build error
Build error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -17,13 +17,13 @@ CONSTANTS
|
|
| 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 |
"""
|
| 22 |
AUTO RESTART HF SPACE
|
| 23 |
"""
|
| 24 |
HF_TOKEN = os.environ.get("H4_TOKEN", None)
|
| 25 |
api = HfApi()
|
| 26 |
|
|
|
|
| 27 |
def restart_space():
|
| 28 |
api.restart_space(repo_id=HF_REPO, token=HF_TOKEN)
|
| 29 |
|
|
@@ -40,7 +40,6 @@ multimodal_leaderboard = github_data["multimodal"]["dataframes"][0] # Get the l
|
|
| 40 |
text_leaderboard = text_leaderboard.iloc[:, :4]
|
| 41 |
multimodal_leaderboard = multimodal_leaderboard.iloc[:, :4]
|
| 42 |
|
| 43 |
-
|
| 44 |
"""
|
| 45 |
VERSIONS UTILS
|
| 46 |
"""
|
|
@@ -51,6 +50,8 @@ 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:
|
|
@@ -61,6 +62,7 @@ def _initial_trend_plot():
|
|
| 61 |
# You can choose default values (matching what you want to show first)
|
| 62 |
return get_final_trend_plot("Text", mobile_view=False)
|
| 63 |
|
|
|
|
| 64 |
"""
|
| 65 |
MAIN APPLICATION
|
| 66 |
"""
|
|
@@ -71,7 +73,6 @@ hf_app = gr.Blocks(css="""
|
|
| 71 |
}
|
| 72 |
""")
|
| 73 |
with hf_app:
|
| 74 |
-
|
| 75 |
gr.HTML(TITLE)
|
| 76 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
| 77 |
|
|
@@ -353,8 +354,9 @@ with hf_app:
|
|
| 353 |
"""
|
| 354 |
with gr.TabItem("📈Trends", elem_id="trends-tab", id=3):
|
| 355 |
with gr.Row():
|
| 356 |
-
mkd_text = gr.Markdown(
|
| 357 |
-
|
|
|
|
| 358 |
with gr.Row():
|
| 359 |
with gr.Column(scale=3):
|
| 360 |
trend_select = gr.Dropdown(
|
|
@@ -390,8 +392,7 @@ with hf_app:
|
|
| 390 |
[trend_plot],
|
| 391 |
queue=True
|
| 392 |
)
|
| 393 |
-
|
| 394 |
-
|
| 395 |
"""
|
| 396 |
####################### FIFTH TAB - VERSIONS AND DETAILS #######################
|
| 397 |
"""
|
|
@@ -446,7 +447,7 @@ with hf_app:
|
|
| 446 |
queue=True
|
| 447 |
)
|
| 448 |
|
| 449 |
-
|
| 450 |
hf_app.load(_initial_trend_plot, None, trend_plot)
|
| 451 |
hf_app.queue()
|
| 452 |
|
|
|
|
| 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 |
AUTO RESTART HF SPACE
|
| 22 |
"""
|
| 23 |
HF_TOKEN = os.environ.get("H4_TOKEN", None)
|
| 24 |
api = HfApi()
|
| 25 |
|
| 26 |
+
|
| 27 |
def restart_space():
|
| 28 |
api.restart_space(repo_id=HF_REPO, token=HF_TOKEN)
|
| 29 |
|
|
|
|
| 40 |
text_leaderboard = text_leaderboard.iloc[:, :4]
|
| 41 |
multimodal_leaderboard = multimodal_leaderboard.iloc[:, :4]
|
| 42 |
|
|
|
|
| 43 |
"""
|
| 44 |
VERSIONS UTILS
|
| 45 |
"""
|
|
|
|
| 50 |
|
| 51 |
global version_df
|
| 52 |
version_df = versions_data['dataframes'][0]
|
| 53 |
+
|
| 54 |
+
|
| 55 |
def select_version_df(name):
|
| 56 |
for i, v in enumerate(versions_data['versions']):
|
| 57 |
if v['name'] == name:
|
|
|
|
| 62 |
# You can choose default values (matching what you want to show first)
|
| 63 |
return get_final_trend_plot("Text", mobile_view=False)
|
| 64 |
|
| 65 |
+
|
| 66 |
"""
|
| 67 |
MAIN APPLICATION
|
| 68 |
"""
|
|
|
|
| 73 |
}
|
| 74 |
""")
|
| 75 |
with hf_app:
|
|
|
|
| 76 |
gr.HTML(TITLE)
|
| 77 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
| 78 |
|
|
|
|
| 354 |
"""
|
| 355 |
with gr.TabItem("📈Trends", elem_id="trends-tab", id=3):
|
| 356 |
with gr.Row():
|
| 357 |
+
mkd_text = gr.Markdown(
|
| 358 |
+
"### Commercial v/s Open-Weight models - clemscore over time. The size of the circles represents the scaled value of the parameters of the models. Larger circles indicate higher parameter values.")
|
| 359 |
+
|
| 360 |
with gr.Row():
|
| 361 |
with gr.Column(scale=3):
|
| 362 |
trend_select = gr.Dropdown(
|
|
|
|
| 392 |
[trend_plot],
|
| 393 |
queue=True
|
| 394 |
)
|
| 395 |
+
|
|
|
|
| 396 |
"""
|
| 397 |
####################### FIFTH TAB - VERSIONS AND DETAILS #######################
|
| 398 |
"""
|
|
|
|
| 447 |
queue=True
|
| 448 |
)
|
| 449 |
|
| 450 |
+
# Load the trend plot initially, to auto-adjust the width according to HF container
|
| 451 |
hf_app.load(_initial_trend_plot, None, trend_plot)
|
| 452 |
hf_app.queue()
|
| 453 |
|