mac9087 commited on
Commit
d77ed52
·
verified ·
1 Parent(s): 22bf6e8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -3
Dockerfile CHANGED
@@ -24,15 +24,17 @@ RUN apt-get update && apt-get install -y \
24
  liblapack-dev \
25
  libopencv-dev \
26
  libomp-dev \
27
- wget \
28
  && apt-get clean \
29
  && rm -rf /var/lib/apt/lists/*
30
 
31
  RUN mkdir -p /tmp/uploads /tmp/results /tmp/huggingface/transformers /tmp/huggingface/datasets /tmp/numba_cache /tmp/.u2net \
32
  && chmod -R 777 /tmp/uploads /tmp/results /tmp/huggingface /tmp/numba_cache /tmp/.u2net
33
 
34
- # Pre-download u2net.pth to the path expected by backgroundremover
35
- RUN wget -O /tmp/.u2net/u2net.pth https://huggingface.co/spaces/nadermx/backgroundremover/resolve/main/u2net.pth \
 
 
 
36
  && chmod 644 /tmp/.u2net/u2net.pth
37
 
38
  # Copy requirements file and install dependencies
 
24
  liblapack-dev \
25
  libopencv-dev \
26
  libomp-dev \
 
27
  && apt-get clean \
28
  && rm -rf /var/lib/apt/lists/*
29
 
30
  RUN mkdir -p /tmp/uploads /tmp/results /tmp/huggingface/transformers /tmp/huggingface/datasets /tmp/numba_cache /tmp/.u2net \
31
  && chmod -R 777 /tmp/uploads /tmp/results /tmp/huggingface /tmp/numba_cache /tmp/.u2net
32
 
33
+ # Install huggingface_hub early to download u2net.pth
34
+ RUN pip install --no-cache-dir huggingface_hub==0.23.0
35
+
36
+ # Download u2net.pth using hf_hub_download with HF_TOKEN
37
+ RUN python -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='nadermx/backgroundremover', filename='u2net.pth', local_dir='/tmp/.u2net', token='${HF_TOKEN}')" \
38
  && chmod 644 /tmp/.u2net/u2net.pth
39
 
40
  # Copy requirements file and install dependencies