stevenkhan commited on
Commit
5c1300e
·
verified ·
1 Parent(s): 4d56ed3

Upload upload.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. upload.py +19 -0
upload.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from huggingface_hub import HfApi
3
+
4
+ api = HfApi()
5
+ repo_id = 'stevenkhan/clashcr'
6
+
7
+ for root, dirs, files in os.walk('.'):
8
+ dirs[:] = [d for d in dirs if d not in ['__pycache__', 'egg-info', '.git']]
9
+ for f in files:
10
+ if f.endswith('.pyc'):
11
+ continue
12
+ path = os.path.join(root, f)
13
+ repo_path = path.replace(os.sep, '/')
14
+ if repo_path.startswith('./'):
15
+ repo_path = repo_path[2:]
16
+ print('Uploading', repo_path)
17
+ api.upload_file(path_or_fileobj=path, path_in_repo=repo_path, repo_id=repo_id, repo_type='model')
18
+
19
+ print('Done')