File size: 903 Bytes
fb3f53f
 
14e7061
 
 
 
 
 
 
fb3f53f
14e7061
 
794b6d3
fb3f53f
14e7061
 
 
 
 
794b6d3
14e7061
 
 
 
 
 
 
 
 
794b6d3
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
FROM python:3.10-slim

# Install system dependencies for llama.cpp
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    cmake \
    git \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy requirement list first for caching
COPY requirements.txt .

# Install Python dependencies (llama-cpp-python compiled with BLAS disabled for HF CPU Spaces)
RUN CMAKE_ARGS="-DLLAMA_BLAS=OFF -DLLAMA_CUBLAS=OFF" \
    pip install --no-cache-dir -r requirements.txt

# Copy app files
COPY . .

# Pre-download model at build time to speed up startup
RUN python -c "from huggingface_hub import hf_hub_download; \
    hf_hub_download(repo_id='bartowski/Llama-3.2-3B-Instruct-GGUF', \
    filename='Llama-3.2-3B-Instruct-Q4_K_M.gguf', \
    cache_dir='/app/models', local_dir_use_symlinks=False)"

EXPOSE 7860

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]