Spaces:
Sleeping
Sleeping
Download deploy.sh from dixitramjendra/MACD_Strategy: direct link, hf CLI and curl.
- Browser
- Download file 2.33 kB
-
https://huggingface.co/spaces/dixitramjendra/MACD_Strategy/resolve/main/deploy.sh
- Command line
-
hf download hf://spaces/dixitramjendra/MACD_Strategy/deploy.sh
-
curl -L -o deploy.sh https://huggingface.co/spaces/dixitramjendra/MACD_Strategy/resolve/main/deploy.sh
2.33 kB
| # 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 | |