Georg commited on
Commit ·
c9ee848
1
Parent(s): 14eec7b
Track binaries with LFS
Browse files- .gitattributes +1 -1
- deploy.sh +73 -0
.gitattributes
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
*.STL filter=lfs diff=lfs merge=lfs -text
|
| 2 |
*.stl filter=lfs diff=lfs merge=lfs -text
|
| 3 |
*.png filter=lfs diff=lfs merge=lfs -text
|
| 4 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 1 |
*.stl filter=lfs diff=lfs merge=lfs -text
|
| 2 |
*.png filter=lfs diff=lfs merge=lfs -text
|
| 3 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.STL filter=lfs diff=lfs merge=lfs -text
|
deploy.sh
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Nova-Sim deployment script (HuggingFace Spaces)
|
| 3 |
+
|
| 4 |
+
set -e
|
| 5 |
+
|
| 6 |
+
if [ -z "${BASH_VERSION:-}" ]; then
|
| 7 |
+
exec /bin/bash "$0" "$@"
|
| 8 |
+
fi
|
| 9 |
+
|
| 10 |
+
HF_SPACE="gpue/nova-sim"
|
| 11 |
+
ENV_FILE="${ENV_FILE:-.env.local}"
|
| 12 |
+
|
| 13 |
+
exec > >(tee -a deploy.logs) 2>&1
|
| 14 |
+
|
| 15 |
+
echo "==================================="
|
| 16 |
+
echo "Nova-Sim Deployment"
|
| 17 |
+
echo "==================================="
|
| 18 |
+
echo ""
|
| 19 |
+
|
| 20 |
+
# Load tokens from env file
|
| 21 |
+
if [ -f "${ENV_FILE}" ]; then
|
| 22 |
+
set -a
|
| 23 |
+
# shellcheck disable=SC1090
|
| 24 |
+
source "${ENV_FILE}"
|
| 25 |
+
set +a
|
| 26 |
+
else
|
| 27 |
+
echo "Warning: ${ENV_FILE} not found"
|
| 28 |
+
fi
|
| 29 |
+
|
| 30 |
+
HF_TOKEN="${HF_TOKEN:-${HUGGINGFACE_TOKEN:-}}"
|
| 31 |
+
if [ -z "${HF_TOKEN}" ]; then
|
| 32 |
+
echo "Error: missing HF token (set HF_TOKEN or HUGGINGFACE_TOKEN)"
|
| 33 |
+
exit 1
|
| 34 |
+
fi
|
| 35 |
+
|
| 36 |
+
# Ensure huggingface_hub (and hf CLI) are available via local venv
|
| 37 |
+
VENV_DIR=".deploy-venv"
|
| 38 |
+
PY_BIN="${VENV_DIR}/bin/python3"
|
| 39 |
+
HF_BIN="${VENV_DIR}/bin/hf"
|
| 40 |
+
|
| 41 |
+
if [ ! -x "${PY_BIN}" ]; then
|
| 42 |
+
echo "Creating deploy venv at ${VENV_DIR}..."
|
| 43 |
+
python3 -m venv "${VENV_DIR}"
|
| 44 |
+
fi
|
| 45 |
+
|
| 46 |
+
if ! "${PY_BIN}" -c "import huggingface_hub" >/dev/null 2>&1; then
|
| 47 |
+
echo "Installing huggingface_hub in deploy venv..."
|
| 48 |
+
"${PY_BIN}" -m pip install --quiet huggingface_hub
|
| 49 |
+
fi
|
| 50 |
+
|
| 51 |
+
# Commit local changes before push so Spaces builds the right ref
|
| 52 |
+
if [[ -n $(git status -s) ]]; then
|
| 53 |
+
echo "Committing changes for Space build context..."
|
| 54 |
+
git add Dockerfile requirements.txt mujoco_server.py frontend/index.html README.md .dockerignore
|
| 55 |
+
if git diff --cached --quiet; then
|
| 56 |
+
echo "No staged changes for Space build context"
|
| 57 |
+
else
|
| 58 |
+
git commit -m "Prepare HF Space deployment"
|
| 59 |
+
echo "✓ Space build context committed"
|
| 60 |
+
fi
|
| 61 |
+
fi
|
| 62 |
+
|
| 63 |
+
PUSH_URL="https://user:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE}"
|
| 64 |
+
|
| 65 |
+
echo "Pushing to ${HF_SPACE}..."
|
| 66 |
+
git push "${PUSH_URL}" HEAD:main --force
|
| 67 |
+
echo "✓ Push complete"
|
| 68 |
+
echo ""
|
| 69 |
+
|
| 70 |
+
if [ -x "${HF_BIN}" ]; then
|
| 71 |
+
echo "Space status:"
|
| 72 |
+
"${HF_BIN}" repo info "spaces/${HF_SPACE}" || true
|
| 73 |
+
fi
|