Spaces:
Running
Running
Commit
•
4d599bf
1
Parent(s):
d0af8be
- app/init.py +14 -19
app/init.py
CHANGED
@@ -8,22 +8,17 @@ scheduler = None
|
|
8 |
|
9 |
if SYNC_DB:
|
10 |
print("Syncing DB...")
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
print("Creating DB...")
|
26 |
-
create_db()
|
27 |
-
else:
|
28 |
-
print("Creating DB...")
|
29 |
-
create_db()
|
|
|
8 |
|
9 |
if SYNC_DB:
|
10 |
print("Syncing DB...")
|
11 |
+
download_db()
|
12 |
+
# Sync local DB with remote repo every 5 minute (only if a change is detected)
|
13 |
+
print(f"Scheduler created: {DB_DATASET_ID} -> {DB_PATH}")
|
14 |
+
scheduler = CommitScheduler(
|
15 |
+
repo_id=DB_DATASET_ID,
|
16 |
+
repo_type="dataset",
|
17 |
+
folder_path=Path(DB_PATH).parent,
|
18 |
+
every=5,
|
19 |
+
allow_patterns=DB_NAME,
|
20 |
+
token=os.getenv('HF_TOKEN')
|
21 |
+
)
|
22 |
+
|
23 |
+
print("Create DB if non-existant...")
|
24 |
+
create_db()
|
|
|
|
|
|
|
|
|
|