File size: 819 Bytes
e418977 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
from dotenv import load_dotenv
import os
from huggingface_hub import HfApi, HfFolder, create_repo, upload_folder
# Load environment variables from .env file
load_dotenv()
# Load the access token from the environment variable
access_token = os.getenv("HF_ACCESS_TOKEN")
if access_token is None:
raise ValueError("HF_ACCESS_TOKEN environment variable is not set")
# Save the token to the Hugging Face folder
HfFolder.save_token(access_token)
# Authenticate
HfFolder.get_token()
# Create a new repository
create_repo("image-search-engine-fashion", private=False)
# Upload the folder
upload_folder(
folder_path=r"C:\Users\rudra\Documents\GitHub\image-search-engine",
repo_id="rudra0410/image-search-engine-fashion",
repo_type="model",
commit_message="Initial upload"
) |