Mezura / src /envs.py
nmmursit's picture
initial commit
3232d64 verified
raw
history blame contribute delete
700 Bytes
import os
import dotenv
import logging
# .env dosyasını yükle
dotenv.load_dotenv()
from huggingface_hub import HfApi
# TOKEN is automatically set when running in Hugging Face Spaces
# For local development, use the token from the .env file
TOKEN = os.environ.get("HFTOKEN", os.environ.get("HF_TOKEN", os.environ.get("HUGGINGFACE_TOKEN", os.environ.get("TOKEN", None))))
# Replace these with your custom repository paths
OWNER = "newmindai"
REPO_ID = f"{OWNER}/mezura"
CACHE_PATH = os.getenv("HF_HOME", ".")
# Initialize API if TOKEN is available, otherwise set to None
try:
API = HfApi(token=TOKEN)
except Exception as e:
logging.warning("Could not initialize HfApi")
API = None