File size: 1,561 Bytes
2258854
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cdd30b3
 
 
 
 
2258854
 
 
 
3e96dea
2258854
 
 
 
 
3e96dea
2258854
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Automated deployment script for Hugging Face

# Load environment variables
if [ -f "/home/ramram/Desktop/SELF_LEARNING/Medical RAG/.env" ]; then
    export $(grep -v '^#' "/home/ramram/Desktop/SELF_LEARNING/Medical RAG/.env" | xargs)
fi

if [ -z "$HF_TOKEN" ]; then
    echo "❌ Error: HF_TOKEN not found in .env"
    exit 1
fi

DEST_DIR="/home/ramram/Desktop/SELF_LEARNING/Medical RAG/documents/Signal/hf_deployment"
cd "$DEST_DIR"

# Get Space URL from git remote
SPACE_URL=$(git remote get-url origin)

if [ -z "$SPACE_URL" ]; then
    echo "❌ Error: Git remote 'origin' not found. Please run deploy.sh manually once to set it up."
    exit 1
fi

# Extract the repo path (e.g., dixitramjendra/MACD_Strategy)
# Handle both https and ssh formats
REPO_PATH=$(echo "$SPACE_URL" | sed -E 's|https://huggingface.co/spaces/||' | sed -E 's|git@huggingface.co:spaces/||' | sed -E 's|\.git$||')
USERNAME=$(echo "$REPO_PATH" | cut -d'/' -f1)
AUTH_URL="https://$USERNAME:$HF_TOKEN@huggingface.co/spaces/$REPO_PATH"

echo "🚀 Starting automated deployment to $SPACE_URL..."

# Add Files
git add Dockerfile requirements.txt start.sh forex_macd_strategy.py forex_macd_dashboard.html forex_macd_signals.json signal_history.json active_signals.json README.md

# Commit
git commit -m "Automated deployment: Syncing latest signals and strategy" || echo "No changes to commit"

# Push using token for authentication
git push origin main --force

if [ $? -eq 0 ]; then
    echo "✅ Deployment successful!"
else
    echo "❌ Deployment failed."
    exit 1
fi