CoolFace
Modelpublic

Piyusha00997/daruka_vectorstore

sourceHugging Faceupdated 9d agoView on Hugging Face
0likes
check_token.py30 linesDownload Raw Back to root
1#!/usr/bin/env python2"""Check for cached HF token or help with authentication."""3 4import os5from pathlib import Path6 7# Check for cached token8hf_cache = Path.home() / ".cache" / "huggingface" / "token"9 10print("[*] Checking for cached Hugging Face token...")11if hf_cache.exists():12    with open(hf_cache) as f:13        token = f.read().strip()14        if token:15            print(f"[✓] Found cached token: {token[:20]}...")16            print(f"[*] This can be used to authenticate")17        else:18            print(f"[✗] Token file is empty")19else:20    print(f"[✗] No cached token found at: {hf_cache}")21    print()22    print("[!] HuggingFace Hub requires an API token to upload")23    print("[*] To generate a token:")24    print("    1. Go to: https://huggingface.co/settings/tokens")25    print("    2. Click 'New token'")26    print("    3. Name: 'daruka_upload' or similar")27    print("    4. Type: 'write' (to allow uploads)")28    print("    5. Copy the token")29    print("    6. Run: hf auth login --token <your-token>")30