deepdraft / src /deepengineer /common_path.py
Charles Azam
feat: check if on spaces
485e053
raw
history blame contribute delete
496 Bytes
from pathlib import Path
import os
def is_on_spaces():
return "SPACE_ID" in os.environ or "HF_SPACE_ID" in os.environ
DEEPENGINEER_CODE_DIR = Path(__file__).parent
DEEPENGINEER_SRC_DIR = DEEPENGINEER_CODE_DIR.parent
DEEPENGINEER_ROOT_DIR = DEEPENGINEER_SRC_DIR.parent
assert DEEPENGINEER_CODE_DIR.name == "deepengineer"
assert DEEPENGINEER_SRC_DIR.name == "src"
if is_on_spaces():
DATA_DIR = Path("/data")
else:
DATA_DIR = DEEPENGINEER_ROOT_DIR / "data"
assert DATA_DIR.exists()