Spaces:
Runtime error
Runtime error
root
commited on
Commit
·
a803331
1
Parent(s):
b7b4feb
update Dockerfile
Browse files- Dockerfile +34 -0
Dockerfile
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official lightweight Python image.
|
| 2 |
+
# https://hub.docker.com/_/python
|
| 3 |
+
FROM python:3.10-slim
|
| 4 |
+
|
| 5 |
+
# Copy local code to the container image.
|
| 6 |
+
ENV APP_HOME /app
|
| 7 |
+
WORKDIR $APP_HOME
|
| 8 |
+
# COPY . ./
|
| 9 |
+
|
| 10 |
+
RUN apt update && apt install -y \
|
| 11 |
+
libgl1-mesa-glx \
|
| 12 |
+
libglib2.0-dev \
|
| 13 |
+
git
|
| 14 |
+
|
| 15 |
+
# Install production dependencies.
|
| 16 |
+
RUN pip install --upgrade pip
|
| 17 |
+
|
| 18 |
+
RUN git clone https://github.com/LiteraturePro/MODNet.git
|
| 19 |
+
|
| 20 |
+
RUN cp -r MODNet/* ./
|
| 21 |
+
|
| 22 |
+
RUN pip install -r requirements.txt
|
| 23 |
+
|
| 24 |
+
# CPU
|
| 25 |
+
#RUN pip install torch==1.7.1+cpu torchvision==0.8.2+cpu torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
|
| 26 |
+
RUN pip install torch==1.13.0+cpu torchvision==0.14.0+cpu torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cpu
|
| 27 |
+
|
| 28 |
+
# Run the web service on container startup. Here we use the gunicorn
|
| 29 |
+
# webserver, with one worker process and 8 threads.
|
| 30 |
+
# For environments with multiple CPU cores, increase the number of workers
|
| 31 |
+
# to be equal to the cores available.
|
| 32 |
+
CMD exec gunicorn --bind 0.0.0.0:7860 --workers 1 --threads 8 --timeout 0 app:app
|
| 33 |
+
|
| 34 |
+
# CMD exec gunicorn --bind 0.0.0.0:$PORT --workers 1 --threads 8 --timeout 0 app:app
|