File size: 1,345 Bytes
aa9ea7c
ffa2d87
9109efa
b0dbc84
 
ffa2d87
aa9ea7c
 
 
9109efa
aa9ea7c
9109efa
eed1bc9
292054e
9109efa
 
aa9ea7c
292054e
 
 
78c0b3c
292054e
9109efa
 
 
 
eed1bc9
 
9109efa
aa9ea7c
 
78c0b3c
aa9ea7c
 
 
 
 
 
 
 
 
9109efa
 
aa9ea7c
9109efa
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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"]