File size: 910 Bytes
bb8ee60
20dee97
da3e4cd
20dee97
da3e4cd
bb8ee60
 
48a7789
da3e4cd
20dee97
da3e4cd
20dee97
da3e4cd
 
 
20dee97
 
 
 
da3e4cd
 
 
20dee97
da3e4cd
 
bb8ee60
da3e4cd
 
bb8ee60
da3e4cd
 
bb8ee60
 
 
20dee97
 
da3e4cd
 
20dee97
6cc3030
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Use slim Python
FROM python:3.10-slim

# Set working directory
WORKDIR /app

# Copy your app and model
COPY . .

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    ffmpeg \
    libsm6 \
    libxext6 \
    g++ \
    build-essential \
    cmake \
    python3-dev \
    wget \
    && rm -rf /var/lib/apt/lists/*

# Upgrade pip
RUN pip install --upgrade pip

# Install PyTorch CPU
RUN pip install torch==2.0.1+cpu torchvision==0.15.2+cpu --index-url https://download.pytorch.org/whl/cpu

# Install Python dependencies
RUN pip install -r requirements.txt

# Clone Detectron2 so we have the full project including PointRend YAMLs
RUN git clone https://github.com/facebookresearch/detectron2.git /app/detectron2
RUN python -m pip install -e /app/detectron2

# Expose FastAPI port
EXPOSE 7860

# Start FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]