Invalid credentials in Authorization header... Please help

John6666
Tue, 22 Jul 2025 11:19:40 +0000

Great! Personally, I also recommend the HF_DEBUG environment variable.

import logging
from huggingface_hub.utils._runtime import dump_environment_info
#####################################################

API_TOKEN = os.environ['HF_TOKEN']
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"

os.environ.setdefault('GRADIO_ANALYTICS_ENABLED', 'False')
os.environ.setdefault('HF_HUB_DISABLE_TELEMETRY', '1')
os.environ.setdefault('HF_DEBUG', '1')

dump_environment_info()
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)