Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py (#8)
Browse files- Update app.py (6837122dc3283c0bf5d37bee63b13f3d5ef3cbec)
- Update requirements.txt (18f8d98993476cebfe79c46b2d1582a7b16562d5)
- app.py +9 -0
- requirements.txt +1 -0
app.py
CHANGED
@@ -8,6 +8,8 @@ from huggingface_hub import HfApi, Repository
|
|
8 |
|
9 |
from onnx_export import convert
|
10 |
|
|
|
|
|
11 |
DATASET_REPO_URL = "https://huggingface.co/datasets/optimum/exporters"
|
12 |
DATA_FILENAME = "data.csv"
|
13 |
DATA_FILE = os.path.join("data", DATA_FILENAME)
|
@@ -151,4 +153,11 @@ with gr.Blocks() as demo:
|
|
151 |
outputs=output,
|
152 |
)
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
demo.launch()
|
|
|
8 |
|
9 |
from onnx_export import convert
|
10 |
|
11 |
+
from apscheduler.schedulers.background import BackgroundScheduler
|
12 |
+
|
13 |
DATASET_REPO_URL = "https://huggingface.co/datasets/optimum/exporters"
|
14 |
DATA_FILENAME = "data.csv"
|
15 |
DATA_FILE = os.path.join("data", DATA_FILENAME)
|
|
|
153 |
outputs=output,
|
154 |
)
|
155 |
|
156 |
+
def restart_space():
|
157 |
+
HfApi().restart_space(repo_id="onnx/export", token=HF_TOKEN, factory_reboot=True)
|
158 |
+
|
159 |
+
scheduler = BackgroundScheduler()
|
160 |
+
scheduler.add_job(restart_space, "interval", seconds=21600)
|
161 |
+
scheduler.start()
|
162 |
+
|
163 |
demo.launch()
|
requirements.txt
CHANGED
@@ -2,3 +2,4 @@ torch==2.1.2
|
|
2 |
transformers==4.37.2
|
3 |
huggingface_hub==0.20.3
|
4 |
optimum[onnxruntime,exporters]==1.16.2
|
|
|
|
2 |
transformers==4.37.2
|
3 |
huggingface_hub==0.20.3
|
4 |
optimum[onnxruntime,exporters]==1.16.2
|
5 |
+
APScheduler
|