You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[`create_commit`] uses the HTTP protocol to upload files to the Hub. It automatically takes care of uploading large files and binary files with the Git LFS protocol.
139
+
There are currently two kind of operations supported by the [`create_commit`] method:
140
+
141
+
1.[`CommitOperationAdd`] to upload a file to the Hub. If the file already exists, its content will be overwritten. It takes two arguments:
142
+
*`path_in_repo`: the path in the repository where the file should be uploaded
143
+
*`path_or_fileobj`: either a path to a file on your filesystem, or a file-like object. The content of the file to upload to the Hub.
144
+
2.[`CommitOperationDelete`] to remove a file from a repository. It takes `path_in_repo` as an argument.
145
+
146
+
Instead of [`create_commit`], you can also use the following convenience methods:
147
+
*[`upload_file`] to upload a single file to a repo on the Hub
148
+
*[`upload_folder`] to upload a local directory to a repo on the Hub
149
+
*[`delete_file`] to delete a single file from a repo on the Hub
150
+
*[`metadata_update`] to update a repo's metadata
151
+
152
+
All these methods use the `create_commit` API under the hood.
153
+
For a more detailed description, visit the [`hf_api`] documentation page.
0 commit comments