Spaces:
Running
Running
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() | |