Spaces:
Sleeping
Sleeping
Download scripts/init_db.py from so-21-si/spot-the-diff: direct link, hf CLI and curl.
- Browser
- Download file 631 Bytes
-
https://huggingface.co/spaces/so-21-si/spot-the-diff/resolve/main/scripts/init_db.py
- Command line
-
hf download hf://spaces/so-21-si/spot-the-diff/scripts/init_db.py
-
curl -L -o init_db.py https://huggingface.co/spaces/so-21-si/spot-the-diff/resolve/main/scripts/init_db.py
631 Bytes
| """Initialize the SQLite database. | |
| Usage: | |
| python scripts/init_db.py | |
| """ | |
| from __future__ import annotations | |
| import sys | |
| from pathlib import Path | |
| # Add project root to path | |
| PROJECT_ROOT = Path(__file__).resolve().parent.parent | |
| sys.path.insert(0, str(PROJECT_ROOT)) | |
| from src.config import Config | |
| from src.database import init_db | |
| def main() -> None: | |
| db_path = Config.DATABASE_PATH | |
| db_dir = Path(db_path).parent | |
| db_dir.mkdir(parents=True, exist_ok=True) | |
| print(f"Initializing database at: {db_path}") | |
| init_db(db_path) | |
| print("Database initialized successfully.") | |
| if __name__ == "__main__": | |
| main() | |