Upload upload_file_to_hf.py
Browse files- upload_file_to_hf.py +11 -9
upload_file_to_hf.py
CHANGED
@@ -67,15 +67,17 @@ def upload_file_to_hf(hf_access_token: str, repo: str, repo_type: str, upload_fi
|
|
67 |
|
68 |
operations.append(CommitOperationAdd(path_in_repo = hf_file_path, path_or_fileobj = local_file_path))
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
|
|
79 |
|
80 |
|
81 |
def get_args():
|
|
|
67 |
|
68 |
operations.append(CommitOperationAdd(path_in_repo = hf_file_path, path_or_fileobj = local_file_path))
|
69 |
|
70 |
+
try:
|
71 |
+
api.create_commit(
|
72 |
+
repo_id = repo,
|
73 |
+
operations = operations,
|
74 |
+
commit_message = f"upload",
|
75 |
+
repo_type = repo_type,
|
76 |
+
token = hf_access_token
|
77 |
+
)
|
78 |
+
logging.warning("上传文件结束")
|
79 |
+
except:
|
80 |
+
logging.error("上传文件出错")
|
81 |
|
82 |
|
83 |
def get_args():
|