Spaces:
Running
Running
File size: 617 Bytes
df7cbb5 9f6582b 4d599bf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
from .config import *
from .db import *
from huggingface_hub import CommitScheduler
from pathlib import Path
import os
scheduler = None
if SYNC_DB:
print("Syncing DB...")
download_db()
# Sync local DB with remote repo every 5 minute (only if a change is detected)
print(f"Scheduler created: {DB_DATASET_ID} -> {DB_PATH}")
scheduler = CommitScheduler(
repo_id=DB_DATASET_ID,
repo_type="dataset",
folder_path=Path(DB_PATH).parent,
every=5,
allow_patterns=DB_NAME,
token=os.getenv('HF_TOKEN')
)
print("Create DB if non-existant...")
create_db()
|