Spaces:
Runtime error
Runtime error
final changes
Browse files- Dockerfile +10 -11
Dockerfile
CHANGED
|
@@ -1,26 +1,26 @@
|
|
| 1 |
# Use a lightweight Python image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
# 1. Install System Dependencies (Compilers + PDF tools)
|
| 5 |
-
#
|
| 6 |
-
# -
|
| 7 |
-
#
|
| 8 |
-
# - libgl1: required for opencv/vision tasks
|
| 9 |
RUN apt-get update && apt-get install -y \
|
| 10 |
build-essential \
|
| 11 |
cmake \
|
| 12 |
-
g++ \
|
| 13 |
-
gcc \
|
| 14 |
poppler-utils \
|
| 15 |
libgl1 \
|
| 16 |
libglib2.0-0 \
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
-
# 2. Upgrade pip
|
| 20 |
RUN pip install --upgrade pip
|
| 21 |
|
| 22 |
# 3. Install Python Libraries
|
| 23 |
-
# We
|
| 24 |
RUN CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" pip install --no-cache-dir \
|
| 25 |
"llama-cpp-python[server]" \
|
| 26 |
huggingface_hub \
|
|
@@ -30,13 +30,12 @@ RUN CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" pip install --no-cac
|
|
| 30 |
fastapi \
|
| 31 |
pillow
|
| 32 |
|
| 33 |
-
# 4. Download the Model
|
| 34 |
-
#
|
| 35 |
RUN huggingface-cli download Qwen/Qwen2-VL-7B-Instruct-GGUF qwen2-vl-7b-instruct-q4_k_m.gguf --local-dir /app/model
|
| 36 |
RUN huggingface-cli download Qwen/Qwen2-VL-7B-Instruct-GGUF mmproj-model-f16.gguf --local-dir /app/model
|
| 37 |
|
| 38 |
# 5. Copy your API code
|
| 39 |
-
WORKDIR /app
|
| 40 |
COPY app.py .
|
| 41 |
|
| 42 |
# 6. Run the API Server
|
|
|
|
| 1 |
# Use a lightweight Python image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set the working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
# 1. Install System Dependencies (Compilers + PDF tools)
|
| 8 |
+
# 'build-essential' and 'cmake' are REQUIRED for llama-cpp-python
|
| 9 |
+
# 'poppler-utils' is for PDF conversion
|
| 10 |
+
# 'libgl1' is for vision tasks
|
|
|
|
| 11 |
RUN apt-get update && apt-get install -y \
|
| 12 |
build-essential \
|
| 13 |
cmake \
|
|
|
|
|
|
|
| 14 |
poppler-utils \
|
| 15 |
libgl1 \
|
| 16 |
libglib2.0-0 \
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
+
# 2. Upgrade pip
|
| 20 |
RUN pip install --upgrade pip
|
| 21 |
|
| 22 |
# 3. Install Python Libraries
|
| 23 |
+
# We use CMAKE_ARGS to enable optimizations (makes it faster on CPU)
|
| 24 |
RUN CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" pip install --no-cache-dir \
|
| 25 |
"llama-cpp-python[server]" \
|
| 26 |
huggingface_hub \
|
|
|
|
| 30 |
fastapi \
|
| 31 |
pillow
|
| 32 |
|
| 33 |
+
# 4. Download the Model files
|
| 34 |
+
# This saves the model inside the Docker image so it doesn't download on every restart
|
| 35 |
RUN huggingface-cli download Qwen/Qwen2-VL-7B-Instruct-GGUF qwen2-vl-7b-instruct-q4_k_m.gguf --local-dir /app/model
|
| 36 |
RUN huggingface-cli download Qwen/Qwen2-VL-7B-Instruct-GGUF mmproj-model-f16.gguf --local-dir /app/model
|
| 37 |
|
| 38 |
# 5. Copy your API code
|
|
|
|
| 39 |
COPY app.py .
|
| 40 |
|
| 41 |
# 6. Run the API Server
|