nouamanetazi HF staff commited on
Commit
4d599bf
1 Parent(s): d0af8be
Files changed (1) hide show
  1. 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
- try:
12
- download_db()
13
- # Sync local DB with remote repo every 5 minute (only if a change is detected)
14
- print(f"Scheduler created: {DB_DATASET_ID} -> {DB_PATH}")
15
- scheduler = CommitScheduler(
16
- repo_id=DB_DATASET_ID,
17
- repo_type="dataset",
18
- folder_path=Path(DB_PATH).parent,
19
- every=5,
20
- allow_patterns=DB_NAME,
21
- token=os.getenv('HF_TOKEN')
22
- )
23
- except Exception as e:
24
- print(f"Error syncing DB: {e}")
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()