Spaces:
Runtime error
Runtime error
File size: 1,034 Bytes
4a93bdf e0edc1b 11fcb81 4a93bdf 0d42689 4a93bdf e0edc1b 11fcb81 4a93bdf 11fcb81 e0edc1b 4a93bdf e0edc1b 11fcb81 4a93bdf 18fb415 4a93bdf 11fcb81 95a2c95 | 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 | FROM python:3.10-slim
# 1. Install system dependencies for PyMuPDF and basic building
RUN apt-get update && apt-get install -y \
build-essential \
libgl1 \
libglib2.0-0 \
wget \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /code
# 2. Install llama-cpp-python using a PRE-COMPILED wheel optimized for HF Spaces
# This is a direct download link that skips the 'Building wheel' process entirely
RUN pip install --no-cache-dir \
https://huggingface.co/Luigi/llama-cpp-python-wheels-hf-spaces-free-cpu/resolve/main/llama_cpp_python-0.3.16-cp310-cp310-linux_x86_64.whl
# 3. Copy requirements and install (Ensure llama-cpp-python is NOT in your requirements.txt)
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir -r /code/requirements.txt
COPY . .
# 4. Permissions and Cache for the model
RUN mkdir -p /code/cache && chmod 777 /code/cache
ENV HF_HOME=/code/cache
ENV TRANSFORMERS_CACHE=/code/cache
# Start the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |