Spaces:
Running
Running
add scheduler
Browse files- app.py +10 -0
- requirements.txt +15 -0
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
import pandas as pd
|
3 |
import os
|
4 |
from huggingface_hub import snapshot_download
|
|
|
5 |
|
6 |
from src.display.about import (
|
7 |
CITATION_BUTTON_LABEL,
|
@@ -12,6 +13,7 @@ from src.display.about import (
|
|
12 |
TITLE,
|
13 |
)
|
14 |
from src.display.css_html_js import custom_css
|
|
|
15 |
|
16 |
# clone / pull the lmeh eval data
|
17 |
TOKEN = os.environ.get("TOKEN", None)
|
@@ -24,6 +26,9 @@ snapshot_download(
|
|
24 |
token=TOKEN
|
25 |
)
|
26 |
|
|
|
|
|
|
|
27 |
# Load the CSV file
|
28 |
def load_csv(file_path):
|
29 |
data = pd.read_csv(file_path)
|
@@ -62,3 +67,8 @@ with demo:
|
|
62 |
)
|
63 |
|
64 |
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import pandas as pd
|
3 |
import os
|
4 |
from huggingface_hub import snapshot_download
|
5 |
+
from apscheduler.schedulers.background import BackgroundScheduler
|
6 |
|
7 |
from src.display.about import (
|
8 |
CITATION_BUTTON_LABEL,
|
|
|
13 |
TITLE,
|
14 |
)
|
15 |
from src.display.css_html_js import custom_css
|
16 |
+
from src.envs import API
|
17 |
|
18 |
# clone / pull the lmeh eval data
|
19 |
TOKEN = os.environ.get("TOKEN", None)
|
|
|
26 |
token=TOKEN
|
27 |
)
|
28 |
|
29 |
+
def restart_space():
|
30 |
+
API.restart_space(repo_id="lukecq/SeaExam_leaderboard", token=TOKEN)
|
31 |
+
|
32 |
# Load the CSV file
|
33 |
def load_csv(file_path):
|
34 |
data = pd.read_csv(file_path)
|
|
|
67 |
)
|
68 |
|
69 |
demo.launch()
|
70 |
+
|
71 |
+
scheduler = BackgroundScheduler()
|
72 |
+
scheduler.add_job(restart_space, "interval", seconds=20)
|
73 |
+
scheduler.start()
|
74 |
+
demo.queue(default_concurrency_limit=40).launch()
|
requirements.txt
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
APScheduler==3.10.1
|
2 |
+
black==23.11.0
|
3 |
+
click==8.1.3
|
4 |
+
datasets==2.14.5
|
5 |
+
gradio==4.4.0
|
6 |
+
gradio_client==0.7.0
|
7 |
+
huggingface-hub>=0.18.0
|
8 |
+
matplotlib==3.7.1
|
9 |
+
numpy==1.24.2
|
10 |
+
pandas==2.0.0
|
11 |
+
python-dateutil==2.8.2
|
12 |
+
requests==2.28.2
|
13 |
+
tqdm==4.65.0
|
14 |
+
transformers==4.35.2
|
15 |
+
tokenizers>=0.15.0
|