File size: 590 Bytes
dc0fafa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Use official Python image
FROM python:3.9

# Set working directory
WORKDIR /code

# Copy requirements and install dependencies
# Note: We use the CPU version of PyTorch to keep the image small
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir -r /code/requirements.txt

# Copy the rest of the files
COPY . .

# Grant permissions (sometimes needed for HF)
RUN chmod -R 777 /code

# Run the app
CMD ["python", "app.py"]