Spaces:
Sleeping
Sleeping
1. 30분에 한번 repo 재시작
Browse files
app.py
CHANGED
|
@@ -11,7 +11,13 @@ from src.about import (
|
|
| 11 |
from src.display.css_html_js import custom_css
|
| 12 |
from huggingface_hub import HfApi
|
| 13 |
api = HfApi()
|
| 14 |
-
last_updated =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
def get_evaluation():
|
|
@@ -28,7 +34,7 @@ def get_evaluation():
|
|
| 28 |
except ValueError:
|
| 29 |
ret = default_evaluation()
|
| 30 |
|
| 31 |
-
|
| 32 |
return ret
|
| 33 |
|
| 34 |
|
|
@@ -48,7 +54,7 @@ def default_evaluation():
|
|
| 48 |
"Etc": "-"
|
| 49 |
}]
|
| 50 |
df = pd.DataFrame(default_data)
|
| 51 |
-
|
| 52 |
return df
|
| 53 |
|
| 54 |
|
|
@@ -66,12 +72,13 @@ leaderboard_df = original_df.copy()
|
|
| 66 |
|
| 67 |
|
| 68 |
def restart_leaderboard():
|
| 69 |
-
global original_df, leaderboard_df
|
| 70 |
-
original_df = get_evaluation()
|
| 71 |
-
leaderboard_df = original_df.copy()
|
| 72 |
repo_id = "qinference/AIM100Leaderboard"
|
| 73 |
api.pause_space(repo_id=repo_id, repo_type="space")
|
| 74 |
api.restart_space(repo_id=repo_id, repo_type="space")
|
|
|
|
| 75 |
|
| 76 |
|
| 77 |
leaderboard = gr.Blocks(css=custom_css)
|
|
@@ -107,7 +114,7 @@ with leaderboard:
|
|
| 107 |
leaderboard_table,
|
| 108 |
)
|
| 109 |
scheduler = BackgroundScheduler()
|
| 110 |
-
scheduler.add_job(restart_leaderboard, "interval", seconds=
|
| 111 |
scheduler.start()
|
| 112 |
with gr.Row():
|
| 113 |
gr.HTML(last_updated)
|
|
|
|
| 11 |
from src.display.css_html_js import custom_css
|
| 12 |
from huggingface_hub import HfApi
|
| 13 |
api = HfApi()
|
| 14 |
+
last_updated = "---"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def set_last_update():
|
| 18 |
+
global last_updated
|
| 19 |
+
last_updated = "<p style='text-align: right; padding-right: 5px;'>" + datetime.now().strftime(
|
| 20 |
+
'Last updated at %Y-%m-%d %H:%m:%S') + "</p>"
|
| 21 |
|
| 22 |
|
| 23 |
def get_evaluation():
|
|
|
|
| 34 |
except ValueError:
|
| 35 |
ret = default_evaluation()
|
| 36 |
|
| 37 |
+
set_last_update()
|
| 38 |
return ret
|
| 39 |
|
| 40 |
|
|
|
|
| 54 |
"Etc": "-"
|
| 55 |
}]
|
| 56 |
df = pd.DataFrame(default_data)
|
| 57 |
+
set_last_update()
|
| 58 |
return df
|
| 59 |
|
| 60 |
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
def restart_leaderboard():
|
| 75 |
+
# global original_df, leaderboard_df
|
| 76 |
+
# original_df = get_evaluation()
|
| 77 |
+
# leaderboard_df = original_df.copy()
|
| 78 |
repo_id = "qinference/AIM100Leaderboard"
|
| 79 |
api.pause_space(repo_id=repo_id, repo_type="space")
|
| 80 |
api.restart_space(repo_id=repo_id, repo_type="space")
|
| 81 |
+
set_last_update()
|
| 82 |
|
| 83 |
|
| 84 |
leaderboard = gr.Blocks(css=custom_css)
|
|
|
|
| 114 |
leaderboard_table,
|
| 115 |
)
|
| 116 |
scheduler = BackgroundScheduler()
|
| 117 |
+
scheduler.add_job(restart_leaderboard, "interval", seconds=1800)
|
| 118 |
scheduler.start()
|
| 119 |
with gr.Row():
|
| 120 |
gr.HTML(last_updated)
|