3D-Viewer / modules /constants.py
Surn's picture
Huggingface.co server only bug fixes
0933474
raw
history blame
759 Bytes
# modules/constants.py
# constants.py contains all the constants used in the project
import os
from pathlib import Path
from dotenv import load_dotenv
# Load environment variables from .env file
dotenv_path = Path(__file__).parent.parent / '.env'
load_dotenv(dotenv_path)
IS_SHARED_SPACE = "Surn/3D-Viewer" in os.environ.get('SPACE_ID', '')
HF_API_TOKEN = os.getenv("HF_TOKEN")
if not HF_API_TOKEN:
raise ValueError("HF_TOKEN is not set. Please check your .env file.")
try:
if os.environ['TMPDIR']:
TMPDIR = os.environ['TMPDIR']
else:
TMPDIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp')
except:
TMPDIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp')
os.makedirs(TMPDIR, exist_ok=True)