#!/bin/bash # Setup script for HF_TOKEN on Hugging Face Spaces # Run this locally to create a .env file, then commit and push to deploy # Use the token from environment or prompt for it if [ -z "$HF_TOKEN" ]; then echo "HF_TOKEN not set in environment." echo "To set up authentication for your Space:" echo "" echo "Option 1: Set token via environment variable (Linux/macOS)" echo " export HF_TOKEN='your_token_here'" echo " ./setup_token.sh" echo "" echo "Option 2: Go to https://huggingface.co/spaces/bassat6969/miewid-animalclef-reid/settings" echo " and add a Repository Secret named HF_TOKEN with your token value" echo "" exit 1 fi # Create .env file (local development only - not committed) cat > .env << EOF HF_TOKEN=$HF_TOKEN EOF echo "✓ Created .env file with HF_TOKEN" echo "Note: .env is in .gitignore and won't be committed" echo "For Hugging Face Spaces deployment, add HF_TOKEN as a Repository Secret in Settings"