Spaces:
Running
Running
mrfakename
commited on
Commit
•
4cb3b9d
1
Parent(s):
c4e8be0
Update app.py
Browse files
app.py
CHANGED
@@ -216,6 +216,13 @@ def restart_space():
|
|
216 |
token=os.getenv('HF_TOKEN')
|
217 |
)
|
218 |
time.sleep(60 * 60) # Every hour
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
print("Restarting space")
|
220 |
api.restart_space(repo_id=os.getenv('HF_ID'))
|
221 |
def sync_db():
|
|
|
216 |
token=os.getenv('HF_TOKEN')
|
217 |
)
|
218 |
time.sleep(60 * 60) # Every hour
|
219 |
+
print("Syncing DB before restarting space")
|
220 |
+
api.upload_file(
|
221 |
+
path_or_fileobj='database.db',
|
222 |
+
path_in_repo='database.db',
|
223 |
+
repo_id=os.getenv('DATASET_ID'),
|
224 |
+
repo_type='dataset'
|
225 |
+
)
|
226 |
print("Restarting space")
|
227 |
api.restart_space(repo_id=os.getenv('HF_ID'))
|
228 |
def sync_db():
|