diff --git a/annif/cli.py b/annif/cli.py index f11b019c..1f007073 100644 --- a/annif/cli.py +++ b/annif/cli.py @@ -651,7 +651,7 @@ def run_upload( fobjs, operations = [], [] try: - fobjs, operations = hfh_util.prepare_commits(projects, repo_id) + fobjs, operations = hfh_util.prepare_commits(projects, repo_id, token) api = HfApi() api.create_commit( repo_id=repo_id, diff --git a/annif/hfh_util.py b/annif/hfh_util.py index 7249bd82..67015373 100644 --- a/annif/hfh_util.py +++ b/annif/hfh_util.py @@ -64,7 +64,9 @@ def get_matching_projects(pattern: str) -> list[AnnifProject]: ] -def prepare_commits(projects: list[AnnifProject], repo_id: str) -> tuple[list, list]: +def prepare_commits( + projects: list[AnnifProject], repo_id: str, token: str +) -> tuple[list, list]: """Prepare and pre-upload data and config commit operations for projects to a Hugging Face Hub repository.""" from huggingface_hub import preupload_lfs_files @@ -76,7 +78,7 @@ def prepare_commits(projects: list[AnnifProject], repo_id: str) -> tuple[list, l for data_dir in all_dirs: fobj, operation = _prepare_datadir_commit(data_dir) - preupload_lfs_files(repo_id, additions=[operation]) + preupload_lfs_files(repo_id, additions=[operation], token=token) fobjs.append(fobj) operations.append(operation)