from huggingface_hub import HfApi import os # Replace with your repository details repo_id = "ericsonwillians/distilbert-base-uncased-steam-sentiment" # Path to your local directory containing files local_directory = "./" # Initialize API api = HfApi() # Loop through files and upload them for root, _, files in os.walk(local_directory): # Skip .git directory and other unwanted files if ".git" in root: continue for file in files: full_path = os.path.join(root, file) relative_path = os.path.relpath(full_path, local_directory) # Maintain file structure # Skip files like README.md if you want to manually edit metadata later if relative_path.startswith(".git") or file.endswith(".pyc"): continue print(f"Uploading {relative_path}...") api.upload_file( path_or_fileobj=full_path, path_in_repo=relative_path, repo_id=repo_id, repo_type="model" # Change to "dataset" if needed ) print("Upload complete!")