stephenebert commited on
Commit
cf56062
·
verified ·
1 Parent(s): 5862f35

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -4
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM python:3.11-slim
2
 
3
  ENV PYTHONDONTWRITEBYTECODE=1 \
4
  PYTHONUNBUFFERED=1 \
@@ -15,6 +15,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
15
  && rm -rf /var/lib/apt/lists/* \
16
  && git lfs install
17
 
 
18
  COPY requirements.txt .
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
@@ -22,14 +23,16 @@ RUN pip install --no-cache-dir -r requirements.txt
22
  RUN python - <<'PY'
23
  import nltk
24
  nltk.download('punkt'); nltk.download('averaged_perceptron_tagger')
25
- from transformers import BlipForConditionalGeneration, BlipProcessor
26
- BlipProcessor.from_pretrained('Salesforce/blip-image-captioning-base')
27
- BlipForConditionalGeneration.from_pretrained('Salesforce/blip-image-captioning-base')
28
  print("Models ready")
29
  PY
30
 
 
31
  COPY . .
32
  RUN mkdir -p /app/data
33
 
34
  EXPOSE 7860
35
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
+ FROM python:3.10-slim
2
 
3
  ENV PYTHONDONTWRITEBYTECODE=1 \
4
  PYTHONUNBUFFERED=1 \
 
15
  && rm -rf /var/lib/apt/lists/* \
16
  && git lfs install
17
 
18
+ # Python deps
19
  COPY requirements.txt .
20
  RUN pip install --no-cache-dir -r requirements.txt
21
 
 
23
  RUN python - <<'PY'
24
  import nltk
25
  nltk.download('punkt'); nltk.download('averaged_perceptron_tagger')
26
+ from transformers import BlipProcessor, BlipForConditionalGeneration
27
+ BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-base")
28
+ BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base")
29
  print("Models ready")
30
  PY
31
 
32
+ # App code
33
  COPY . .
34
  RUN mkdir -p /app/data
35
 
36
  EXPOSE 7860
37
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
38
+