| 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') | |