File size: 601 Bytes
5c1300e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
from huggingface_hub import HfApi

api = HfApi()
repo_id = 'stevenkhan/clashcr'

for root, dirs, files in os.walk('.'):
    dirs[:] = [d for d in dirs if d not in ['__pycache__', 'egg-info', '.git']]
    for f in files:
        if f.endswith('.pyc'):
            continue
        path = os.path.join(root, f)
        repo_path = path.replace(os.sep, '/')
        if repo_path.startswith('./'):
            repo_path = repo_path[2:]
        print('Uploading', repo_path)
        api.upload_file(path_or_fileobj=path, path_in_repo=repo_path, repo_id=repo_id, repo_type='model')

print('Done')