File size: 1,600 Bytes
add24bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
# One clean commit with NO .jpg in git history (HF rejects raw binaries in any commit).
set -euo pipefail
cd "$(dirname "$0")"

unset GIT_ASKPASS SSH_ASKPASS

if [[ ! -f weights/prebackbone_a11_ca.pt ]]; then
  echo "ERROR: weights/prebackbone_a11_ca.pt missing. Run extract_prebackbone_weights.py first."
  exit 1
fi

if command -v hf >/dev/null 2>&1; then
  TOKEN="$(hf auth token 2>/dev/null | tr -d '[:space:]')"
  if [[ -n "${TOKEN}" ]]; then
    CRED_FILE="${HOME}/.git-credentials"
    grep -v "huggingface.co" "${CRED_FILE}" 2>/dev/null > "${CRED_FILE}.tmp" || true
    [[ -f "${CRED_FILE}.tmp" ]] && mv "${CRED_FILE}.tmp" "${CRED_FILE}"
    echo "https://vinayedula:${TOKEN}@huggingface.co" >> "${CRED_FILE}"
    chmod 600 "${CRED_FILE}"
  fi
fi

git lfs install
git lfs track "*.pt" "*.pth"

grep -q "^examples/" .gitignore 2>/dev/null || echo "examples/" >> .gitignore

git checkout --orphan main-clean
git rm -rf --cached . 2>/dev/null || true

git add \
  .gitattributes \
  .gitignore \
  app.py \
  prebackbone_infer.py \
  extract_prebackbone_weights.py \
  requirements.txt \
  setup.sh \
  README.md \
  deploy_to_refdiffnet.sh \
  git_hf_sync.sh \
  fix_hf_binaries.sh \
  push_clean_space.sh \
  vendor/ \
  weights/prebackbone_a11_ca.pt

git commit -m "RefDiffNet: A11_CA prebackbone demo (clean history, no images in git)"

git branch -M main
git remote set-url origin https://huggingface.co/spaces/vinayedula/RefDiffNet

echo "==> Force pushing clean history..."
git push -f origin main

echo "==> Done: https://huggingface.co/spaces/vinayedula/RefDiffNet"