doc-extraction-api / Dockerfile
ror-12's picture
Update Dockerfile
aa9ea7c verified
Raw History Blame Contribute Delete
1.35 kB
# Use Full Python 3.10 (Includes system tools)
FROM python:3.10
WORKDIR /app
# 1. Install System Dependencies
# 'wget': To download files directly (Bypasses huggingface-cli errors)
# 'poppler-utils': For PDF conversion
# 'libgl1': For Vision
RUN apt-get update && apt-get install -y \
wget \
poppler-utils \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# 2. Install Python Libraries (Pre-built Wheels)
RUN pip install --no-cache-dir --prefer-binary \
"llama-cpp-python>=0.3.1" \
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
RUN pip install --no-cache-dir \
huggingface_hub \
pdf2image \
python-multipart \
uvicorn \
fastapi \
pillow
# 3. Create Model Directory
RUN mkdir -p /app/model
# 4. Download Model (Direct WGET - No Cache Errors)
# Model: Llava 1.6 Mistral 7B (Q4_K_M) - High Accuracy
RUN wget -O /app/model/model.gguf https://huggingface.co/cjpais/llava-1.6-mistral-7b-gguf/resolve/main/llava-v1.6-mistral-7b.Q4_K_M.gguf
# 5. Download Projector (Direct WGET)
# This is the vision adapter for Llava 1.6
RUN wget -O /app/model/mmproj.gguf https://huggingface.co/cjpais/llava-1.6-mistral-7b-gguf/resolve/main/mmproj-model-f16.gguf
# 6. Copy App Code
COPY app.py .
# 7. Run Server
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]