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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -9
Dockerfile CHANGED
@@ -6,11 +6,10 @@ ENV HF_HOME=/tmp/huggingface
6
  ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
7
  ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
8
  ENV NUMBA_CACHE_DIR=/tmp/numba_cache
9
- ENV U2NET_HOME=/tmp/u2net
10
  ENV PYTHONDONTWRITEBYTECODE=1
11
  ENV PYTHONUNBUFFERED=1
12
  ENV CUDA_VISIBLE_DEVICES=""
13
-
14
  ENV HF_TOKEN=${HF_TOKEN}
15
 
16
  RUN apt-get update && apt-get install -y \
@@ -25,25 +24,25 @@ RUN apt-get update && apt-get install -y \
25
  liblapack-dev \
26
  libopencv-dev \
27
  libomp-dev \
 
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
  # Copy requirements file and install dependencies
35
  COPY requirements.txt .
36
  RUN pip install --no-cache-dir -U pip && \
37
  pip install --no-cache-dir -r requirements.txt && \
38
  pip cache purge
39
-
40
-
41
-
42
 
43
  COPY app.py .
44
 
45
-
46
-
47
  EXPOSE 7860
48
 
49
  CMD ["python", "app.py"]
 
6
  ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
7
  ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
8
  ENV NUMBA_CACHE_DIR=/tmp/numba_cache
9
+ ENV HOME=/tmp
10
  ENV PYTHONDONTWRITEBYTECODE=1
11
  ENV PYTHONUNBUFFERED=1
12
  ENV CUDA_VISIBLE_DEVICES=""
 
13
  ENV HF_TOKEN=${HF_TOKEN}
14
 
15
  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
39
  COPY requirements.txt .
40
  RUN pip install --no-cache-dir -U pip && \
41
  pip install --no-cache-dir -r requirements.txt && \
42
  pip cache purge
 
 
 
43
 
44
  COPY app.py .
45
 
 
 
46
  EXPOSE 7860
47
 
48
  CMD ["python", "app.py"]