Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +17 -9
Dockerfile
CHANGED
|
@@ -1,29 +1,36 @@
|
|
| 1 |
# Base image with PyTorch and CUDA for GPU support
|
| 2 |
FROM pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime
|
| 3 |
|
| 4 |
-
# Install system dependencies
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
git \
|
| 7 |
wget \
|
|
|
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
-
# Install Python packages including Hugging Face Transformers
|
| 11 |
RUN pip install --no-cache-dir \
|
| 12 |
torch \
|
| 13 |
torchvision \
|
| 14 |
transformers \
|
| 15 |
requests \
|
| 16 |
-
Flask
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Create a working directory for model files
|
| 19 |
-
RUN mkdir /models
|
| 20 |
-
WORKDIR /models
|
| 21 |
|
| 22 |
-
# Download Meta Sapiens Pose model
|
| 23 |
-
RUN git
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
# Download MotionBERT model
|
| 26 |
-
RUN git clone https://huggingface.co/walterzhu/MotionBERT /models/motionbert
|
|
|
|
| 27 |
|
| 28 |
# Copy the inference script (app.py) into the container
|
| 29 |
COPY app.py /app/app.py
|
|
@@ -33,3 +40,4 @@ EXPOSE 7860
|
|
| 33 |
|
| 34 |
# Run the Flask app
|
| 35 |
CMD ["python", "/app/app.py"]
|
|
|
|
|
|
| 1 |
# Base image with PyTorch and CUDA for GPU support
|
| 2 |
FROM pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime
|
| 3 |
|
| 4 |
+
# Install system dependencies and Git LFS for large model files
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
git \
|
| 7 |
wget \
|
| 8 |
+
git-lfs \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# Install Python packages including Hugging Face Transformers and Flask
|
| 12 |
RUN pip install --no-cache-dir \
|
| 13 |
torch \
|
| 14 |
torchvision \
|
| 15 |
transformers \
|
| 16 |
requests \
|
| 17 |
+
Flask
|
| 18 |
+
|
| 19 |
+
# Set Hugging Face cache to a writable directory
|
| 20 |
+
ENV TRANSFORMERS_CACHE=/app/cache
|
| 21 |
+
RUN mkdir -p /app/cache
|
| 22 |
|
| 23 |
# Create a working directory for model files
|
| 24 |
+
RUN mkdir -p /models/sapiens_pose /models/motionbert
|
|
|
|
| 25 |
|
| 26 |
+
# Download Meta Sapiens Pose model using Git LFS
|
| 27 |
+
RUN git lfs install && \
|
| 28 |
+
git clone https://huggingface.co/facebook/sapiens-pose-1b-torchscript /models/sapiens_pose && \
|
| 29 |
+
ls /models/sapiens_pose # List contents to verify download
|
| 30 |
|
| 31 |
+
# Download MotionBERT model using Git LFS
|
| 32 |
+
RUN git clone https://huggingface.co/walterzhu/MotionBERT /models/motionbert && \
|
| 33 |
+
ls /models/motionbert # List contents to verify download
|
| 34 |
|
| 35 |
# Copy the inference script (app.py) into the container
|
| 36 |
COPY app.py /app/app.py
|
|
|
|
| 40 |
|
| 41 |
# Run the Flask app
|
| 42 |
CMD ["python", "/app/app.py"]
|
| 43 |
+
|