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") | |
#authenticate | |
hf_api=HfApi(token=access_token) | |
# 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" | |
) | |