#!/bin/bash # Helper script to deploy the explorer to Hugging Face Spaces from evals/deepeval_visualization set -e # Colors for output BLUE='\033[0;34m' GREEN='\033[0;32m' RED='\033[0;31m' NC='\033[0m' echo -e "${BLUE}=== Data360-MCP HF Space Deployment (from evals/deepeval_visualization) ===${NC}" # Navigate to deploy directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" # Initialize git if not already a repo if [ ! -d ".git" ]; then git init -b main git config user.name "Hugging Face Deployer" git config user.email "deploy@huggingface.co" fi # Get HF remote URL REMOTE_URL=$(git remote get-url space 2>/dev/null || true) if [ -z "$REMOTE_URL" ]; then read -p "Enter your Hugging Face Space Git URL (default: https://huggingface.co/spaces/rafmacalaba/data360-mcp-explorer): " USER_URL if [ -z "$USER_URL" ]; then USER_URL="https://huggingface.co/spaces/rafmacalaba/data360-mcp-explorer" fi git remote add space "$USER_URL" echo -e "${GREEN}Added git remote 'space' pointing to $USER_URL${NC}" else echo -e "Found existing 'space' remote pointing to: $REMOTE_URL" fi # Ensure build artifacts and pycache are ignored echo "Staging files..." git add -A # Stage and commit locally inside the deploy folder git commit -m "Deploy explorer to Hugging Face Spaces" || echo "No changes to commit" # Push to Hugging Face Space echo -e "${BLUE}Pushing code to Hugging Face Space remote...${NC}" git push --force space main echo -e "${GREEN}Deployment complete! Your Space is building at: $REMOTE_URL${NC}"