File size: 692 Bytes
38a55af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

WORKDIR /app

# Install dependencies
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt

# Copy application code
COPY app.py /app/app.py

# Copy model artifact
RUN mkdir -p /app/deployment_files
COPY deployment_files/sales_predictor.joblib /app/deployment_files/sales_predictor.joblib

# Expose default port used by Spaces if PORT is not provided
EXPOSE 7860

# Start the API using gunicorn, binding to the dynamic PORT provided by HF Spaces
ENV PORT=7860
CMD ["sh", "-c", "gunicorn -w 1 -k gthread -b 0.0.0.0:$PORT app:sales_predictor_api"]