File size: 804 Bytes
ba0b7ee
14969c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ba0b7ee
 
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
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
FROM python:3.9-slim

RUN useradd -m -u 1000 user

# Install required packages
USER root
RUN apt-get update && apt-get install -y \
    libgl1-mesa-glx \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app

# Copy requirements and install Python packages
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy model files and application code
COPY --chown=user ./models/best.pt /app/models/
COPY --chown=user ./classes.txt /app/
COPY --chown=user ./app.py /app/

# Set up the correct port for Hugging Face
ENV PORT=7860

# Run the application with uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]