| FROM python:3.11-slim | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| libopencv-dev \ | |
| build-essential \ | |
| python3-opencv \ | |
| && apt-get clean | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir \ | |
| -r requirements.txt | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| # Set home to the user's home directory | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set working directory | |
| WORKDIR $HOME/app | |
| # Copy application files | |
| COPY ONNX0630.py I2M_R4.onnx . | |
| COPY example.png . | |
| COPY utils.py . | |
| COPY det_engine.py . | |
| COPY app.py . | |
| # Expose port for Hugging Face Spaces (7860 is default) | |
| EXPOSE 7860 | |
| # Command to run the application | |
| # CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |
| CMD ["python", "app.py"] |