Sign inSign up

shrey2003/deepseek-ocr2-dockerized

By shrey2003

•Updated 9 months ago

Deepseek ocr 2 amd 64 ready to deploy image- POST /ocr/image POST ocr/pdf GET /health

Image
Machine learning & AI
Data science
1

2.8K

shrey2003/deepseek-ocr2-dockerized repository overview

⁠DeepSeek-OCR 2: Dockerized API Server

DeepSeek-OCR-2-Dockerized⁠ A high-performance, containerized OCR service based on DeepSeek-OCR 2. This image uses the vLLM backend for ultra-fast inference and provides a simple FastAPI interface to process images and PDFs.

⁠🚀 Key Features

  • DeepSeek-OCR 2 Support: Advanced visual causal flow for superior document understanding.
  • vLLM Powered: Optimized for NVIDIA GPUs with fast batch processing.
  • Simple API: RESTful endpoints for individual images and multi-page PDFs.
  • PDF to Markdown: Built-in logic to convert complex PDF layouts directly to structured Markdown using grounding prompts.

⁠🛠️ Hardware Requirements

  • GPU: NVIDIA GPU with Compute Capability 8.0+ (A10, A100, H100, RTX 30/40 series recommended).
  • VRAM: 16GB+ recommended for optimal performance with Gundam mode (dynamic resolutions).
  • Drivers: NVIDIA Container Toolkit installed on the host.

⁠🐳 Running the Container

docker run --gpus all \
  -p 8000:8000 \
  -e MAX_CONCURRENCY=5 \
  -e GPU_MEMORY_UTILIZATION=0.9 \
  shrey2003/deepseek-ocr2-dockerized:amd64

⁠📡 API Endpoints

⁠1. Process Image

URL: /ocr/image
Method: POST
Payload: multipart/form-data

  • file: (Image binary)
  • prompt: (Optional) e.g., <image>\n<|grounding|>Convert the document to markdown.
⁠2. Process PDF

URL: /ocr/pdf
Method: POST
Payload: multipart/form-data

  • file: (PDF binary)
⁠3. Health Check

URL: /health
Method: GET

⁠⌨️ Sample Usage (cURL)

Convert Image to Markdown:

curl -X POST http://localhost:8000/ocr/image \
  -F "[email protected]" \
  -F "prompt=<image>\n<|grounding|>Convert the document to markdown."

Extract Text from PDF:

curl -X POST http://localhost:8000/ocr/pdf \
  -F "[email protected]"

⁠⚙️ Environment Variables

VariableDefaultDescription
MODEL_PATH/app/models/...Path to the DeepSeek-OCR2 weights inside the container.
MAX_CONCURRENCY5Maximum number of concurrent sequences the vLLM engine handles.
GPU_MEMORY_UTILIZATION0.9Fraction of GPU memory for vLLM (0.0 - 1.0).

⁠📄 License

This Dockerized API is released under the MIT License. The underlying DeepSeek-OCR 2 model weights are subject to DeepSeek's Model License⁠.

Tag summary

Content type

Image

Digest

sha256:abb0419b5…

Size

13.6 GB

Last updated

9 months ago

docker pull shrey2003/deepseek-ocr2-dockerized:amd64