Spaces:
Runtime error
Runtime error
Commit
·
5291fa8
1
Parent(s):
85b33d8
Add civitai-to-hf-uploader
Browse files- app.py +12 -0
- requirements.txt +1 -0
app.py
CHANGED
@@ -8,6 +8,14 @@ import re
|
|
8 |
import uuid
|
9 |
from typing import Optional
|
10 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
def download_file(url, file_path, folder):
|
12 |
headers = {}
|
13 |
try:
|
@@ -252,5 +260,9 @@ Once uploaded, it will add this repository to CivitaiArchive.com as a mirror.
|
|
252 |
outputs=[output]
|
253 |
)
|
254 |
|
|
|
|
|
|
|
|
|
255 |
demo.queue(default_concurrency_limit=50)
|
256 |
demo.launch()
|
|
|
8 |
import uuid
|
9 |
from typing import Optional
|
10 |
import json
|
11 |
+
|
12 |
+
from apscheduler.schedulers.background import BackgroundScheduler
|
13 |
+
from huggingface_hub import Repository, HfApi
|
14 |
+
api = HfApi()
|
15 |
+
def restart_space():
|
16 |
+
api.restart_space(repo_id="civitaiarchive/civitai-to-hf-uploader", token=os.environ["HF_TOKEN"])
|
17 |
+
|
18 |
+
|
19 |
def download_file(url, file_path, folder):
|
20 |
headers = {}
|
21 |
try:
|
|
|
260 |
outputs=[output]
|
261 |
)
|
262 |
|
263 |
+
scheduler = BackgroundScheduler()
|
264 |
+
scheduler.add_job(restart_space, 'interval', seconds=3600)
|
265 |
+
scheduler.start()
|
266 |
+
|
267 |
demo.queue(default_concurrency_limit=50)
|
268 |
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
APScheduler==3.10.1
|