Spaces:
Paused
Paused
Download infra/scripts/deploy_huggingface.sh from nathycodes/presentercoach: direct link, hf CLI and curl.
- Browser
- Download file 2.73 kB
-
https://huggingface.co/spaces/nathycodes/presentercoach/resolve/main/infra/scripts/deploy_huggingface.sh
- Command line
-
hf download hf://spaces/nathycodes/presentercoach/infra/scripts/deploy_huggingface.sh
-
curl -L -o deploy_huggingface.sh https://huggingface.co/spaces/nathycodes/presentercoach/resolve/main/infra/scripts/deploy_huggingface.sh
2.73 kB
| set -euo pipefail | |
| ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" | |
| cd "${ROOT_DIR}" | |
| echo "============================================================" | |
| echo " Speech-Machine · Tech Presenter Coach — Free Cloud Deploy" | |
| echo " Target: Hugging Face Spaces (Docker · 2 vCPU · 16 GB RAM)" | |
| echo "============================================================" | |
| echo "" | |
| read -r -p "1) Enter your Hugging Face username: " HF_USER | |
| if [ -z "${HF_USER}" ]; then | |
| echo "Error: Hugging Face username is required." | |
| exit 1 | |
| fi | |
| read -r -p "2) Enter your Space name [presenter-coach]: " SPACE_NAME | |
| SPACE_NAME="${SPACE_NAME:-presenter-coach}" | |
| read -r -s -p "3) Paste your Hugging Face Write Access Token (hf_...): " HF_TOKEN | |
| echo "" | |
| if [ -z "${HF_TOKEN}" ]; then | |
| echo "Error: Hugging Face Write Access Token is required." | |
| exit 1 | |
| fi | |
| # Ensure README.md has Hugging Face Docker Space YAML metadata | |
| python3 - <<'PY' | |
| from pathlib import Path | |
| readme = Path("README.md") | |
| content = readme.read_text(encoding="utf-8") | |
| header = ( | |
| "---\n" | |
| "title: Tech Presenter Coach\n" | |
| "emoji: 🎙️\n" | |
| "colorFrom: red\n" | |
| "colorTo: yellow\n" | |
| "sdk: docker\n" | |
| "app_port: 7860\n" | |
| "---\n\n" | |
| ) | |
| if not content.startswith("---"): | |
| readme.write_text(header + content, encoding="utf-8") | |
| PY | |
| DEPLOY_TMP="$(mktemp -d)" | |
| cleanup() { | |
| rm -rf "${DEPLOY_TMP}" | |
| } | |
| trap cleanup EXIT | |
| echo "" | |
| echo "Preparing clean cloud deployment bundle..." | |
| tar --exclude='.git' \ | |
| --exclude='node_modules' \ | |
| --exclude='.next' \ | |
| --exclude='.venv' \ | |
| --exclude='data' \ | |
| --exclude='__pycache__' \ | |
| --exclude='.pytest_cache' \ | |
| --exclude='Speech_Machine_Banner.png' \ | |
| --exclude='Screenshot_Speech_Machine.png' \ | |
| -cf - . | (cd "${DEPLOY_TMP}" && tar -xf -) | |
| cd "${DEPLOY_TMP}" | |
| git init -q -b main | |
| git config user.email "${HF_USER}@users.noreply.huggingface.co" | |
| git config user.name "${HF_USER}" | |
| git add . | |
| git commit -q -m "Deploy Tech Presenter Coach" | |
| REMOTE_URL="https://${HF_USER}:${HF_TOKEN}@huggingface.co/spaces/${HF_USER}/${SPACE_NAME}" | |
| echo "Pushing to https://huggingface.co/spaces/${HF_USER}/${SPACE_NAME} ..." | |
| git push --force "${REMOTE_URL}" main | |
| DIRECT_HOST="$(echo "${HF_USER}-${SPACE_NAME}" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]/-/g').hf.space" | |
| echo "" | |
| echo "============================================================" | |
| echo " PUSH COMPLETE! Your cloud build is now starting (~3-4 min)" | |
| echo "" | |
| echo " Build status page:" | |
| echo " https://huggingface.co/spaces/${HF_USER}/${SPACE_NAME}" | |
| echo "" | |
| echo " Direct Mac & iPhone App URL (open once status = Running):" | |
| echo " https://${DIRECT_HOST}" | |
| echo "============================================================" | |