File size: 791 Bytes
5a8ecdf
 
e19317d
 
 
712c34b
 
 
 
e19317d
5a8ecdf
 
712c34b
e19317d
 
712c34b
 
e19317d
 
 
712c34b
 
 
5a8ecdf
e19317d
d0d7bc6
e19317d
 
d0d7bc6
 
 
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
FROM python:3.11-slim

ENV PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    HF_HOME=/data/.huggingface \
    HUGGINGFACE_HUB_CACHE=/data/.cache/huggingface/hub \
    # force llama-cpp-python CPU build
    CMAKE_ARGS="-DGGML_NATIVE=OFF" \
    FORCE_CMAKE=1

WORKDIR /app

# System deps to build llama-cpp-python
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    build-essential \
    cmake \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt /app/requirements.txt

RUN pip install --upgrade pip setuptools wheel \
 && pip install -r /app/requirements.txt

COPY main.py /app/main.py
COPY utils.py /app/utils.py

EXPOSE 7860

# PORT is set by HF Spaces; default to 7860 locally
CMD ["bash", "-lc", "uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860}"]