MACD_Strategy / deploy.sh
dixitramjendra's picture
Update strategy with 3 TPs and Trailing SL
b3b70f8
Raw History Blame Contribute Delete
2.33 kB
#!/bin/bash
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${GREEN}πŸš€ Hugging Face Deployment Helper${NC}"
echo "---------------------------------"
echo -e "${YELLOW}Prerequisite:${NC} You must have created a Space on Hugging Face."
echo " - URL: https://huggingface.co/new-space"
echo " - SDK: Docker"
echo ""
# Check for Git
if ! command -v git &> /dev/null; then
echo -e "${RED}❌ Error: Git is not installed.${NC}"
exit 1
fi
# Get Space URL
read -p "Enter your Hugging Face Space URL (e.g., https://huggingface.co/spaces/username/spacename): " SPACE_URL
if [ -z "$SPACE_URL" ]; then
echo -e "${RED}❌ Error: Space URL is required.${NC}"
exit 1
fi
# Initialize Git
if [ ! -d ".git" ]; then
echo "πŸ“¦ Initializing Git repository..."
git init
# Set dummy config if not present (for this repo only)
if [ -z "$(git config user.email)" ]; then
git config user.email "deploy@example.com"
git config user.name "Deployment Bot"
fi
else
echo "πŸ“¦ Git repository already initialized."
fi
# Add/Update Remote
echo "πŸ”— Configuring remote..."
if git remote | grep -q "origin"; then
git remote set-url origin "$SPACE_URL"
else
git remote add origin "$SPACE_URL"
fi
# Pull (to handle initial commit from HF)
echo "⬇️ Pulling remote changes..."
git pull origin main --rebase || echo -e "${YELLOW}⚠️ Pull failed (might be empty repo), proceeding...${NC}"
# Add Files
echo "βž• Adding files..."
git add Dockerfile requirements.txt start.sh forex_macd_strategy.py forex_macd_dashboard.html README.md
# Commit
echo "πŸ’Ύ Committing changes..."
git commit -m "Deploying Forex MACD Dashboard with 3 TPs and Trailing SL"
# Push
echo -e "${GREEN}⬆️ Pushing to Hugging Face...${NC}"
echo -e "${YELLOW}⚠️ Note: You will be asked for your Hugging Face Username and Password.${NC}"
echo -e "${YELLOW} (Password should be an Access Token with 'write' permissions: https://huggingface.co/settings/tokens)${NC}"
echo ""
git push -u origin main
if [ $? -eq 0 ]; then
echo ""
echo -e "${GREEN}βœ… Deployment successful!${NC}"
echo "Check your dashboard at: $SPACE_URL"
else
echo ""
echo -e "${RED}❌ Deployment failed. Please check your credentials and try again.${NC}"
fi