benediktstroebl commited on
Commit
bb94aa7
·
1 Parent(s): 5b0a5d3

added auto update

Browse files
Files changed (3) hide show
  1. app.py +10 -2
  2. envs.py +9 -0
  3. requirements.txt +4 -0
app.py CHANGED
@@ -1,12 +1,16 @@
1
  import gradio as gr
2
  from gradio_leaderboard import Leaderboard, SelectColumns, ColumnFilter
3
  import config
4
- from envs import RESULTS_REPO_ID
5
  from pathlib import Path
6
  import pandas as pd
7
  import os
8
  from utils import parse_json_files, create_scatter_plot
9
  from huggingface_hub import snapshot_download
 
 
 
 
10
 
11
  abs_path = Path(__file__).parent
12
 
@@ -63,4 +67,8 @@ if __name__ == "__main__":
63
  etag_timeout=30,
64
  max_workers=4,
65
  )
66
- demo.launch()
 
 
 
 
 
1
  import gradio as gr
2
  from gradio_leaderboard import Leaderboard, SelectColumns, ColumnFilter
3
  import config
4
+ from envs import RESULTS_REPO_ID, REPO_ID, API
5
  from pathlib import Path
6
  import pandas as pd
7
  import os
8
  from utils import parse_json_files, create_scatter_plot
9
  from huggingface_hub import snapshot_download
10
+ from apscheduler.schedulers.background import BackgroundScheduler
11
+
12
+ def restart_space():
13
+ API.restart_space(repo_id=REPO_ID)
14
 
15
  abs_path = Path(__file__).parent
16
 
 
67
  etag_timeout=30,
68
  max_workers=4,
69
  )
70
+ demo.launch()
71
+
72
+ scheduler = BackgroundScheduler()
73
+ scheduler.add_job(restart_space, "interval", hours=1) # restarted every 1h as backup in case automatic updates are not working
74
+ scheduler.start()
envs.py CHANGED
@@ -1 +1,10 @@
 
 
 
 
 
1
  RESULTS_REPO_ID = 'agent-evals/results'
 
 
 
 
 
1
+ import os
2
+ from huggingface_hub import HfApi
3
+
4
+ HF_TOKEN = os.getenv('HF_TOKEN', None)
5
+
6
  RESULTS_REPO_ID = 'agent-evals/results'
7
+ REPO_ID = 'agent-evals/leaderboard'
8
+
9
+ API = HfApi(token=HF_TOKEN)
10
+
requirements.txt CHANGED
@@ -11,6 +11,7 @@ antlr4-python3-runtime==4.13.1
11
  anyio==4.3.0
12
  applicationinsights==0.11.10
13
  appnope==0.1.3
 
14
  argcomplete==3.1.6
15
  asttokens==2.4.1
16
  attrs==23.2.0
@@ -151,6 +152,7 @@ fastapi-cli==0.0.4
151
  fastjsonschema==2.20.0
152
  ffmpy==0.4.0
153
  filelock==3.13.4
 
154
  fonttools==4.48.1
155
  frozenlist==1.4.1
156
  fsspec==2024.2.0
@@ -168,6 +170,7 @@ httpcore==1.0.5
168
  httptools==0.6.1
169
  httpx==0.27.0
170
  huggingface-hub==0.23.2
 
171
  humanfriendly==10.0
172
  idna==3.6
173
  importlib_metadata==7.1.0
@@ -323,6 +326,7 @@ typer==0.12.3
323
  typing-inspect==0.9.0
324
  typing_extensions==4.9.0
325
  tzdata==2023.3
 
326
  ujson==5.10.0
327
  urllib3==2.2.0
328
  uvicorn==0.30.1
 
11
  anyio==4.3.0
12
  applicationinsights==0.11.10
13
  appnope==0.1.3
14
+ APScheduler==3.10.4
15
  argcomplete==3.1.6
16
  asttokens==2.4.1
17
  attrs==23.2.0
 
152
  fastjsonschema==2.20.0
153
  ffmpy==0.4.0
154
  filelock==3.13.4
155
+ fire==0.6.0
156
  fonttools==4.48.1
157
  frozenlist==1.4.1
158
  fsspec==2024.2.0
 
170
  httptools==0.6.1
171
  httpx==0.27.0
172
  huggingface-hub==0.23.2
173
+ human-eval==1.0
174
  humanfriendly==10.0
175
  idna==3.6
176
  importlib_metadata==7.1.0
 
326
  typing-inspect==0.9.0
327
  typing_extensions==4.9.0
328
  tzdata==2023.3
329
+ tzlocal==5.2
330
  ujson==5.10.0
331
  urllib3==2.2.0
332
  uvicorn==0.30.1