aveni-bench / src /utils.py
mateusz-aveni's picture
Add initial leaderboard view.
d048ec3
raw
history blame contribute delete
628 Bytes
from huggingface_hub.errors import RepositoryNotFoundError, RevisionNotFoundError
from src.envs import API, REPO_ID, TOKEN
from huggingface_hub import snapshot_download
def restart_space():
API.restart_space(repo_id=REPO_ID)
def initialize_file(project_repo, file_path):
try:
print(file_path)
snapshot_download(
repo_id=project_repo,
local_dir=file_path,
repo_type="dataset",
etag_timeout=30,
token=TOKEN
)
except (RepositoryNotFoundError, RevisionNotFoundError, EnvironmentError, OSError, ValueError):
restart_space()