File size: 703 Bytes
9720c18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env bash
set -euo pipefail

SPACE_ID="${1:-ricklon/DeepSeek-OCR-2-Math}"
LOG_KIND="${2:-run}" # run | build

if [[ "$LOG_KIND" != "run" && "$LOG_KIND" != "build" ]]; then
  echo "Usage: $0 [space_id] [run|build]" >&2
  exit 2
fi

TOKEN="${HF_TOKEN:-${HUGGINGFACEHUB_API_TOKEN:-${HUGGING_FACE_HUB_TOKEN:-}}}"
if [[ -z "$TOKEN" && -f "$HOME/.cache/huggingface/token" ]]; then
  TOKEN="$(tr -d '\r\n' < "$HOME/.cache/huggingface/token")"
fi

if [[ -z "$TOKEN" ]]; then
  echo "Missing token. Set HF_TOKEN (recommended, e.g. via Space secret or local .env)." >&2
  exit 1
fi

exec curl -N \
  -H "Authorization: Bearer $TOKEN" \
  "https://huggingface.co/api/spaces/${SPACE_ID}/logs/${LOG_KIND}"