Spaces:
Sleeping
Sleeping
# Base image with PyTorch and CUDA for GPU support | |
FROM pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime | |
# Install system dependencies and Git LFS for large model files | |
RUN apt-get update && apt-get install -y \ | |
git \ | |
wget \ | |
git-lfs \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install Python packages including Hugging Face Transformers and Flask | |
RUN pip install --no-cache-dir \ | |
torch \ | |
torchvision \ | |
transformers \ | |
requests \ | |
Flask | |
# Set Hugging Face cache to a writable directory | |
ENV TRANSFORMERS_CACHE=/app/cache | |
RUN mkdir -p /app/cache | |
# Create a working directory for model files | |
RUN mkdir -p /models/sapiens_pose /models/motionbert | |
# Download Meta Sapiens Pose model using Git LFS | |
RUN git lfs install && \ | |
git clone https://huggingface.co/facebook/sapiens-pose-1b-torchscript /models/sapiens_pose && \ | |
ls /models/sapiens_pose # List contents to verify download | |
# Download MotionBERT model using Git LFS | |
RUN git clone https://huggingface.co/walterzhu/MotionBERT /models/motionbert && \ | |
ls /models/motionbert # List contents to verify download | |
# Copy the inference script (app.py) into the container | |
COPY app.py /app/app.py | |
# Expose the default port for Flask | |
EXPOSE 7860 | |
# Run the Flask app | |
CMD ["python", "/app/app.py"] | |