File size: 306 Bytes
f1b8a40
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import requests
from huggingface_hub import whoami

def validate_hf_token(token):
    """Validates the HF token and returns user info."""
    try:
        user_info = whoami(token=token)
        return user_info
    except Exception as e:
        print(f"Token validation failed: {e}")
        return None