File size: 696 Bytes
a5475c4
 
 
 
 
 
7deb8bb
 
 
 
 
 
a5475c4
7deb8bb
52229d0
7deb8bb
 
 
 
a5475c4
 
7deb8bb
a5475c4
 
7deb8bb
a5475c4
 
7deb8bb
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
# Base image
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7

# Set working directory
WORKDIR /app

# Create a writable directory for the cache
RUN mkdir -p /.cache/huggingface/hub && chmod -R 777 /.cache

# Set the TRANSFORMERS_CACHE environment variable
ENV TRANSFORMERS_CACHE /.cache/huggingface/hub

# Copy the API files to the container
COPY main.py .
COPY model.pkl .
COPY scaler.pkl .

# Upgrade pip
RUN /usr/local/bin/python -m pip install --upgrade pip

# Install dependencies
RUN pip install --no-cache-dir fastapi pydantic uvicorn scikit-learn joblib pandas numpy 

# Expose the API port
EXPOSE 7860

# Start the API
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]