Ryanfafa commited on
Commit
346fd4f
·
verified ·
1 Parent(s): 37ad06e

Create Dockerfile

Browse files
Files changed (1) hide show
  1. image_captioning/Dockerfile +28 -0
image_captioning/Dockerfile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # System deps for Pillow
6
+ RUN apt-get update && apt-get install -y \
7
+ build-essential \
8
+ libjpeg-dev \
9
+ zlib1g-dev \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Install CPU-only torch first
13
+ RUN pip install --no-cache-dir \
14
+ torch==2.2.2+cpu \
15
+ torchvision==0.17.2+cpu \
16
+ --index-url https://download.pytorch.org/whl/cpu
17
+
18
+ # Copy requirements and install the rest
19
+ COPY requirements.txt /app/requirements.txt
20
+ RUN pip install --no-cache-dir -r /app/requirements.txt
21
+
22
+ # Copy code and model
23
+ COPY . /app
24
+
25
+ # Hugging Face Spaces require listening on port 7860
26
+ EXPOSE 7860
27
+
28
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]