Sign inSign up

edgaras0x4e/deepseek-ocr-2-api

By edgaras0x4e

•Updated 6 months ago

A self-hosted OCR API powered by DeepSeek-OCR-2.

Image
API management
Machine learning & AI
Data science
1

10K+

edgaras0x4e/deepseek-ocr-2-api repository overview

⁠DeepSeek-OCR-2 API

Self-hosted OCR API powered by DeepSeek-OCR-2⁠. Process PDFs and images, get clean markdown output via REST API.

⁠Features

  • Multi-format support: PDF, PNG, JPG, JPEG, BMP, TIFF, WEBP
  • GPU accelerated: NVIDIA CUDA support
  • Async processing: Job queue with progress tracking
  • High accuracy: State-of-the-art DeepSeek-OCR-2 model
  • Optional API key: Built-in authentication
  • Persistent storage: SQLite database with Docker volumes

⁠Requirements

⁠Quick Start

Create docker-compose.yml:

services:
  deepseek-ocr2:
    image: edgaras0x4e/deepseek-ocr-2-api:latest
    container_name: deepseek-ocr2
    ports:
      - "9713:7860"
    volumes:
      - ocr-data:/data
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]
    restart: unless-stopped

volumes:
  ocr-data:

Run:

docker compose up -d

The API will be available at http://localhost:9713. Model (~6.4GB) downloads on first startup.

⁠Usage

Submit a document:

curl -X POST http://localhost:9713/ocr -F "[email protected]"

Response:

{
  "job_id": "abc123...",
  "filename": "document.pdf",
  "status": "queued"
}

Check status:

curl http://localhost:9713/ocr/{job_id}

Get results:

curl http://localhost:9713/ocr/{job_id}/result

Returns markdown text for each page.

⁠API Endpoints

MethodEndpointDescription
POST/ocrUpload PDF or image
GET/ocr/{job_id}Get job status
GET/ocr/{job_id}/pages/{page_num}Get specific page
GET/ocr/{job_id}/resultGet all pages
POST/ocr/{job_id}/cancelCancel job
DELETE/ocr/{job_id}Delete job
GET/jobsList all jobs
GET/healthAPI health check

⁠Configuration

Environment variables:

environment:
  - API_KEY=your-secret-key   
  - OCR_DPI=300               
  - DB_PATH=/data/ocr.db
  - UPLOAD_DIR=/data/uploads

⁠Model Info

  • Model: DeepSeek-OCR-2
  • Size: 6.4GB download
  • VRAM: ~8GB
  • Architecture: DeepSeek-VL-v2 based

⁠License

MIT

Tag summary

Content type

Image

Digest

sha256:d6b334983…

Size

6.9 GB

Last updated

6 months ago

docker pull edgaras0x4e/deepseek-ocr-2-api