File size: 734 Bytes
f392a20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim

WORKDIR /app

# System build deps for llama-cpp-python (CPU + OpenBLAS for speed)
RUN apt-get update && apt-get install -y \
    build-essential \
    cmake \
    libopenblas-dev \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Install Python deps — compile llama-cpp-python with OpenBLAS
COPY requirements.txt .
RUN CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" \
    FORCE_CMAKE=1 \
    pip install --no-cache-dir -r requirements.txt

COPY app.py .

# HuggingFace Spaces expects port 7860
EXPOSE 7860

# Set SPACE_URL at runtime via HF Space secrets/env vars
ENV SPACE_URL=""
ENV N_CTX="8192"
ENV N_THREADS="2"

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