dragonllm-finance-models / restart_hf_space.sh
jeanbaptdzd's picture
feat: Clean deployment to HuggingFace Space with model config test endpoint
8c0b652
#!/bin/bash
# Restart HuggingFace Space to trigger rebuild
# The Space will pull the latest code from the repository
SPACE_ID="jeanbaptdzd/linguacustodia-financial-api"
HF_TOKEN="${HF_TOKEN:-$(grep HF_TOKEN .env | cut -d '=' -f2)}"
if [ -z "$HF_TOKEN" ]; then
echo "❌ HF_TOKEN not found"
echo "Please set HF_TOKEN environment variable or add it to .env file"
exit 1
fi
echo "πŸš€ Restarting HuggingFace Space: $SPACE_ID"
echo "=========================================="
curl -X POST "https://huggingface.co/api/spaces/$SPACE_ID/restart" \
-H "Authorization: Bearer $HF_TOKEN" \
-H "Content-Type: application/json"
echo ""
echo "=========================================="
echo "βœ… Restart request sent!"
echo "🌐 Space URL: https://huggingface.co/spaces/$SPACE_ID"
echo "⏳ Waiting 60 seconds for Space to rebuild..."
sleep 60
echo ""
echo "πŸ§ͺ Testing the /test/model-configs endpoint..."
curl -s "https://jeanbaptdzd-linguacustodia-financial-api.hf.space/test/model-configs" | python3 -m json.tool
echo ""
echo "βœ… Test complete!"