#!/usr/bin/env bash # Push this directory to a Hugging Face Space (static SDK, index.html). # # 1. Create the Space first (Static SDK, blank template): # https://huggingface.co/new-space # 2. export HF_TOKEN=hf_... (a token with write access) # 3. ./deploy.sh /African-Books-Recovery-Project # # Alternatives that need no token: drag this whole folder into the Space's # "Files" tab in the browser, or push it as a git repo: # git init && git remote add origin https://huggingface.co/spaces// # git add . && git commit -m "initial" && git push -u origin main set -euo pipefail REPO="${1:-idiouf/African-Books-Recovery-Project}" : "${HF_TOKEN:?export HF_TOKEN first}" HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" python -m pip install --quiet --upgrade huggingface_hub REPO="$REPO" FOLDER="$HERE" python - <<'PY' import os from huggingface_hub import HfApi repo = os.environ["REPO"] api = HfApi(token=os.environ["HF_TOKEN"]) api.create_repo(repo_id=repo, repo_type="space", space_sdk="static", exist_ok=True) api.upload_folder( repo_id=repo, repo_type="space", folder_path=os.environ["FOLDER"], ignore_patterns=["__pycache__/*", "*.pyc", ".git/*", ".venv/*", "email-*", "ABRP_West_Africa_*"], commit_message="African Books Recovery Project - static dashboard, ETL and sourced research data", ) print("\nhttps://huggingface.co/spaces/" + repo) PY