File size: 492 Bytes
47bae79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from huggingface_hub import login
import os
from dotenv import load_dotenv

load_dotenv()
# Make sure you have set your token as an environment variable
# e.g., in your terminal: export HUGGINGFACEHUB_API_TOKEN="your_token_here"
token = os.getenv("HUGGINGFACEHUB_API_TOKEN")

if not token:
    raise ValueError("Please set the environment variable HUGGINGFACEHUB_API_TOKEN")

# Login programmatically
login(token=token)
print("✅ Logged in to Hugging Face Hub successfully!")