From 31d85105db56028102e90ce441a29fe6150dc688 Mon Sep 17 00:00:00 2001 From: Lucain Date: Mon, 18 Sep 2023 14:30:15 +0200 Subject: [PATCH] Fix upload CLI when pushing to Space (#1669) * Fix upload CLI when pushing to Space * fix CI --- src/huggingface_hub/commands/upload.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/huggingface_hub/commands/upload.py b/src/huggingface_hub/commands/upload.py index 68640297ba..85a879d78a 100644 --- a/src/huggingface_hub/commands/upload.py +++ b/src/huggingface_hub/commands/upload.py @@ -236,7 +236,13 @@ def _upload(self) -> str: if not os.path.isfile(self.local_path) and not os.path.isdir(self.local_path): raise FileNotFoundError(f"No such file or directory: '{self.local_path}'.") repo_id = self.api.create_repo( - repo_id=self.repo_id, repo_type=self.repo_type, exist_ok=True, private=self.private + repo_id=self.repo_id, + repo_type=self.repo_type, + exist_ok=True, + private=self.private, + space_sdk="gradio" if self.repo_type == "space" else None, + # ^ We don't want it to fail when uploading to a Space => let's set Gradio by default. + # ^ I'd rather not add CLI args to set it explicitly as we already have `huggingface-cli repo create` for that. ).repo_id # File-based upload