FROM nvidia/cuda:12.2.2-runtime-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 ENV DOCLAYOUT_MODEL_PATH=/app/models/doclayout_yolo_docstructbench_imgsz1024.onnx WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ python3 python3-pip python3-dev \ ffmpeg libsm6 libxext6 curl wget git \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip3 install --no-cache-dir --upgrade pip && \ pip3 install --no-cache-dir -r requirements.txt # Tải trước model ONNX vào image RUN mkdir -p /app/models && \ wget -q --show-progress -O /app/models/doclayout_yolo_docstructbench_imgsz1024.onnx \ "https://huggingface.co/wybxc/DocLayout-YOLO-DocStructBench-onnx/resolve/main/doclayout_yolo_docstructbench_imgsz1024.onnx?download=true" COPY . . # Hugging Face Spaces mặc định lắng nghe ở port 7860 EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]