Spaces:
Runtime error
Runtime error
File size: 1,157 Bytes
81fef9c 69dc570 81fef9c 69dc570 81fef9c 69dc570 81fef9c 69dc570 81fef9c 69dc570 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import os
from huggingface_hub import HfApi
TOKEN = os.environ.get("HF_TOKEN")
OWNER = os.environ.get("HF_LEADERBOARD_OWNER", "")
REPO_ID = os.environ.get("SPACE_ID") or (f"{OWNER}/apparatus-ocr" if OWNER else "")
QUEUE_REPO = os.environ.get("HF_QUEUE_REPO") or (f"{OWNER}/requests" if OWNER else "")
RESULTS_REPO = os.environ.get("HF_RESULTS_REPO") or (f"{OWNER}/results" if OWNER else "")
# If you setup a cache later, just change HF_HOME
CACHE_PATH = os.getenv("HF_HOME", ".")
REPO_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
LOCAL_DATA_PATH = os.path.join(REPO_ROOT, "data", "leaderboard")
# Local caches
EVAL_REQUESTS_PATH = os.path.join(CACHE_PATH, "eval-queue")
EVAL_RESULTS_PATH = os.path.join(CACHE_PATH, "eval-results")
EVAL_REQUESTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-queue-bk")
EVAL_RESULTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-results-bk")
LOCAL_EVAL_REQUESTS_PATH = os.path.join(LOCAL_DATA_PATH, "requests")
LOCAL_EVAL_RESULTS_PATH = os.path.join(LOCAL_DATA_PATH, "results")
API = HfApi(token=TOKEN)
def has_remote_backend() -> bool:
return bool(TOKEN and QUEUE_REPO and RESULTS_REPO)
|