File size: 1,433 Bytes
ca05f78
a074ed2
ca05f78
a074ed2
ca05f78
 
 
 
 
 
 
 
 
 
a074ed2
ca05f78
 
 
 
 
 
 
 
 
 
 
a074ed2
ca05f78
 
 
 
a074ed2
 
ca05f78
 
 
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
#!/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 <your-username>/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/<user>/<space>
#   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