Spaces:
Running
Running
Commit
·
5f9c44d
1
Parent(s):
4415138
added auto update ever 1 h of HF space
Browse files
app.py
CHANGED
@@ -1,15 +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, 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 |
|
11 |
def restart_space():
|
12 |
-
API.restart_space(repo_id=REPO_ID)
|
13 |
|
14 |
abs_path = Path(__file__).parent
|
15 |
|
@@ -66,4 +67,8 @@ if __name__ == "__main__":
|
|
66 |
etag_timeout=30,
|
67 |
max_workers=4,
|
68 |
)
|
|
|
|
|
|
|
|
|
69 |
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, HF_TOKEN
|
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, token=HF_TOKEN)
|
14 |
|
15 |
abs_path = Path(__file__).parent
|
16 |
|
|
|
67 |
etag_timeout=30,
|
68 |
max_workers=4,
|
69 |
)
|
70 |
+
|
71 |
+
scheduler = BackgroundScheduler()
|
72 |
+
scheduler.add_job(restart_space, "interval", hours=1) # restarted every 1h
|
73 |
+
scheduler.start()
|
74 |
demo.launch()
|