Lenson commited on
Commit
581d2f1
·
1 Parent(s): c6ff317

fix: simplify setup, add datasets mount, proxy_api_key to null

Browse files
Files changed (2) hide show
  1. .hf/setup.sh +5 -35
  2. hf_space_metadata.yaml +2 -0
.hf/setup.sh CHANGED
@@ -5,47 +5,17 @@ echo "========================================"
5
  echo " Codex Proxy - HF Spaces Setup"
6
  echo "========================================"
7
 
8
- # Configuration
9
- HF_DATASET_NAME="${HF_DATASET_NAME:-lenson78/codex-proxy-data}"
10
- HF_TOKEN="${HF_TOKEN:-}"
11
-
12
- # Ensure data directories exist
13
- mkdir -p /app/data
14
- mkdir -p /app/config
15
 
16
  # Set HF Space environment variables if available
17
  if [ -n "$HF_SPACE_ID" ]; then
18
  echo "Running on Hugging Face Spaces: $HF_SPACE_ID"
19
  fi
20
 
21
- # Download config from HF Dataset if exists
22
- if [ -n "$HF_TOKEN" ]; then
23
- echo "Downloading config from HF Dataset: $HF_DATASET_NAME"
24
-
25
- # Download data files
26
- curl -s -H "Authorization: Bearer $HF_TOKEN" \
27
- "https://huggingface.co/api/datasets/$HF_DATASET_NAME/tree/main/data" | \
28
- grep -o '"path":"[^"]*"' | sed 's/"path":"//g' | sed 's/"//g' | while read file; do
29
- mkdir -p "/app/data/$(dirname $file)"
30
- curl -s -H "Authorization: Bearer $HF_TOKEN" \
31
- "https://huggingface.co/datasets/$HF_DATASET_NAME/resolve/main/$file" \
32
- -o "/app/data/$file" || true
33
- done
34
-
35
- # Download config files
36
- curl -s -H "Authorization: Bearer $HF_TOKEN" \
37
- "https://huggingface.co/api/datasets/$HF_DATASET_NAME/tree/main/config" | \
38
- grep -o '"path":"[^"]*"' | sed 's/"path":"//g' | sed 's/"//g' | while read file; do
39
- mkdir -p "/app/config/$(dirname $file)"
40
- curl -s -H "Authorization: Bearer $HF_TOKEN" \
41
- "https://huggingface.co/datasets/$HF_DATASET_NAME/resolve/main/$file" \
42
- -o "/app/config/$file" || true
43
- done
44
-
45
- echo "Config downloaded successfully"
46
- else
47
- echo "HF_TOKEN not set, using default config"
48
- fi
49
 
50
  # Change to app directory
51
  cd /app
 
5
  echo " Codex Proxy - HF Spaces Setup"
6
  echo "========================================"
7
 
8
+ # HF Spaces automatically mounts datasets to /data
9
+ # Data persistence is handled by HF infrastructure
 
 
 
 
 
10
 
11
  # Set HF Space environment variables if available
12
  if [ -n "$HF_SPACE_ID" ]; then
13
  echo "Running on Hugging Face Spaces: $HF_SPACE_ID"
14
  fi
15
 
16
+ # Ensure directories exist (data mounted by HF if configured)
17
+ mkdir -p /app/data
18
+ mkdir -p /app/config
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  # Change to app directory
21
  cd /app
hf_space_metadata.yaml CHANGED
@@ -7,4 +7,6 @@ sdk: docker
7
  app_port: 7860
8
  pinned: false
9
  license: mit
 
 
10
  ---
 
7
  app_port: 7860
8
  pinned: false
9
  license: mit
10
+ datasets:
11
+ - lenson78/codex-proxy-data
12
  ---