Skip to content

Commit

Permalink
Fix upload CLI when pushing to Space (#1669)
Browse files Browse the repository at this point in the history
* Fix upload CLI when pushing to Space

* fix CI
  • Loading branch information
Wauplin committed Sep 18, 2023
1 parent fc1eeaa commit 31d8510
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/huggingface_hub/commands/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 31d8510

Please sign in to comment.