JulianPhillips commited on
Commit
6a6e71d
·
verified ·
1 Parent(s): 6326d5f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -7
Dockerfile CHANGED
@@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y \
11
  RUN pip install --no-cache-dir \
12
  torch \
13
  torchvision \
14
- transformers[cli] \
15
  requests \
16
  Flask \
17
  Pillow
@@ -20,14 +20,17 @@ RUN pip install --no-cache-dir \
20
  ENV TRANSFORMERS_CACHE=/tmp/cache
21
  RUN mkdir -p /tmp/cache
22
 
23
- # Download models using Hugging Face CLI and place them in specified directories
24
  RUN mkdir -p /models/sapiens_pose /models/motionbert
25
 
26
- # Download Meta Sapiens Pose model to /models/sapiens_pose
27
- RUN huggingface-cli download facebook/sapiens-pose-1b-torchscript -d /models/sapiens_pose
 
 
 
28
 
29
- # Download MotionBERT model to /models/motionbert
30
- RUN huggingface-cli download walterzhu/MotionBERT -d /models/motionbert
31
 
32
  # Copy the inference script (app.py) into the container
33
  COPY app.py /app/app.py
@@ -37,4 +40,3 @@ EXPOSE 7860
37
 
38
  # Run the Flask app
39
  CMD ["python", "/app/app.py"]
40
-
 
11
  RUN pip install --no-cache-dir \
12
  torch \
13
  torchvision \
14
+ transformers \
15
  requests \
16
  Flask \
17
  Pillow
 
20
  ENV TRANSFORMERS_CACHE=/tmp/cache
21
  RUN mkdir -p /tmp/cache
22
 
23
+ # Create directories for the models
24
  RUN mkdir -p /models/sapiens_pose /models/motionbert
25
 
26
+ # Python script to download models
27
+ RUN echo "from transformers import AutoModel, AutoTokenizer\n\
28
+ AutoModel.from_pretrained('facebook/sapiens-pose-1b-torchscript').save_pretrained('/models/sapiens_pose')\n\
29
+ AutoModel.from_pretrained('walterzhu/MotionBERT').save_pretrained('/models/motionbert')\n\
30
+ AutoTokenizer.from_pretrained('walterzhu/MotionBERT').save_pretrained('/models/motionbert')" > download_models.py
31
 
32
+ # Run the script to download models
33
+ RUN python download_models.py
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"]