StarThomas1002 commited on
Commit
b135d1d
·
verified ·
1 Parent(s): 71915cd

Upload submit.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. submit.py +23 -0
submit.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import HfApi
2
+ import os
3
+
4
+ # 创建HfApi实例
5
+ api = HfApi()
6
+
7
+ # 定义数据集路径和目标URL
8
+ dataset_dir = "/home/yiyangai/stephenqs/datasets/VIST"
9
+ repo_url = "StarThomas1002/my-VIST-dataset"
10
+
11
+ # 遍历临时目录中的文件并分批上传
12
+ for root, dirs, files in os.walk(dataset_dir):
13
+ for file_name in files:
14
+ file_path = os.path.join(root, file_name)
15
+ relative_path = os.path.relpath(file_path, dataset_dir)
16
+
17
+ # 分块上传文件
18
+ api.upload_file(
19
+ path_or_fileobj=file_path,
20
+ path_in_repo=relative_path,
21
+ repo_id=repo_url,
22
+ repo_type="dataset"
23
+ )