ecopulse / setup.sh
acibZ's picture
Deploy EcoPulse
43abac3
Raw
History Blame Contribute Delete
1.55 kB
#!/bin/bash
# EcoPulse — Hugging Face Spaces build-time setup
# Downloads model checkpoints once at build time so they're cached on disk
# when users visit the Space. Runs automatically by HF Spaces during the
# build phase (not on every page visit).
set -e # Exit on error
echo ""
echo "================================================"
echo " EcoPulse — Build Setup"
echo "================================================"
echo ""
# Create models directory
mkdir -p outputs/models
# 1. Download SAM ViT-B checkpoint (350 MB)
SAM_CHECKPOINT="outputs/models/sam_vit_b_01ec64.pth"
SAM_URL="https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth"
if [ ! -f "$SAM_CHECKPOINT" ]; then
echo ">> Downloading SAM ViT-B checkpoint (350 MB)..."
curl -fL "$SAM_URL" -o "$SAM_CHECKPOINT"
echo ">> SAM checkpoint ready."
else
echo ">> SAM checkpoint already exists — skipping."
fi
# 2. Download trained CNN weights from Hugging Face
CNN_CHECKPOINT="outputs/models/resnet50_eurosat.pth"
CNN_URL="https://huggingface.co/datasets/acibZ/ecopulse-satellite-analysis-resnet50-model-weights/resolve/main/resnet50_eurosat.pth"
if [ ! -f "$CNN_CHECKPOINT" ]; then
echo ">> Downloading CNN weights (95 MB)..."
curl -fL "$CNN_URL" -o "$CNN_CHECKPOINT"
echo ">> CNN weights ready."
else
echo ">> CNN weights already exist — skipping."
fi
echo ""
echo "================================================"
echo " EcoPulse build setup complete."
echo "================================================"
echo ""