File size: 839 Bytes
f1e8369
 
 
5c4120d
 
f1e8369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
set -e

export HF_ENDPOINT="https://hf-mirror.com"

if [ -z "$HF_TOKEN" ]; then
  echo "ERROR: HF_TOKEN not set."
  exit 1
fi

VERSION="${HF_SOURCE_VERSION:-latest}"
FILENAME="code-kg-chat-${VERSION}.tar.gz"

echo "Downloading ${FILENAME} from ${HF_DATASET_ID}..."
python3 -c "
from huggingface_hub import hf_hub_download
import tarfile, os, shutil

path = hf_hub_download(
    repo_id='${HF_DATASET_ID}',
    filename='${FILENAME}',
    repo_type='dataset',
    token='${HF_TOKEN}',
)
print(f'Downloaded: {path}')

for item in os.listdir('/app'):
    full = os.path.join('/app', item)
    if os.path.isdir(full):
        shutil.rmtree(full)
    else:
        os.remove(full)

with tarfile.open(path, 'r:gz') as tar:
    tar.extractall('/app')
print('Extraction complete.')
"

exec python3 /app/server.py --auto-approve-source