Step1. Create a secret in Secrets
First, create a new secret. In this case, we will use HF_TOKEN
but you can name whatever you want.
Step2. Load a secret and log in to Hugging Face
from huggingface_hub import login
from google.colab import userdata
HF_TOKEN=userdata.get('HF_TOKEN')
if HF_TOKEN:
login(HF_TOKEN)
print("Successfully logged in to Hugging Face!")
else:
print("Token is not set. Please save the token first.")
Top comments (0)