from huggingface_hub import HfApi, HfFolder, Repository | |
# Authenticate with Hugging Face Hub | |
api = HfApi() | |
token = HfFolder.get_token() | |
if token is None: | |
raise ValueError("Hugging Face token is not set. Please authenticate first.") | |
# Create or clone the private repository using the token | |
repo = Repository( | |
local_dir="DreamVoice", | |
clone_from="myshell-ai/DreamVoice", | |
use_auth_token=token | |
) | |
repo.lfs_track(".pt") | |
repo.lfs_track(".png") | |
# Add all changes to git | |
repo.git_add() | |
# Commit the changes with a message | |
repo.git_commit("Initial commit") | |
# Push the changes to the remote repository | |
repo.git_push() | |