File size: 661 Bytes
a02f72f
 
 
 
 
 
 
725a959
a02f72f
 
 
 
 
 
 
 
 
 
 
 
 
 
940fdda
a02f72f
 
940fdda
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
FROM python:3.10-slim

# Set working directory
WORKDIR /app

# Install system dependencies required for OpenCV and ONNX
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy all backend files into the container
COPY . .

# Download the ONNX model inside the cloud container
RUN python download_model.py

# Expose the port FastAPI runs on
EXPOSE 7860

# Command to run the application (Hugging Face Spaces expects 0.0.0.0)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]