File size: 868 Bytes
2fd0c28 aef650d 2fd0c28 aef650d 2fd0c28 aef650d 2fd0c28 | 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 | # Use a Python base with high compatibility
FROM python:3.10-slim
# Install system dependencies for OCR and Image processing
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install GLM-OCR and required inference engines
RUN pip install --no-cache-dir \
torch --index-url https://download.pytorch.org/whl/cpu \
transformers \
accelerate \
einops \
pillow \
fastapi \
uvicorn \
python-multipart
# Script to pre-load the model (0.9B is ~1.8GB on disk)
RUN python3 -c "from transformers import AutoModelForCausalLM, AutoTokenizer; \
AutoModelForCausalLM.from_pretrained('THUDM/glm-4v-9b', trust_remote_code=True)"
# Create a simple FastAPI app wrapper
COPY app.py .
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |