Modern OCR web application powered by DeepSeek-OCR with a stunning React frontend and FastAPI backend.
Note: This was a quickly vibe-coded project to test out DeepSeek-OCR! The initial version targeted an RTX 5090, but this fork refreshes the stack for AMD GPUs running ROCm 6.1. The "Find" mode grounding boxes aren't quite working yet - probably my fault in not interpreting the dimensions correctly, but the core OCR functionality is pretty nice so far.
docker compose up --buildThen open:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
- Plain OCR - Raw text extraction
- Describe - Generate image descriptions
- Find - Locate specific terms (grounding boxes WIP)
- Freeform - Custom prompts for anything
- 🎨 Glass morphism design with animated gradients
- 🎯 Drag & drop file upload
- 📦 Grounding box visualization (WIP - dimensions need fixing)
- ✨ Smooth animations (Framer Motion)
- 📋 Copy/Download results
- 🎛️ Advanced settings dropdown
- 📝 Markdown rendering for formatted output
- Frontend: React 18 + Vite 5 + TailwindCSS 3 + Framer Motion 11
- Backend: FastAPI + PyTorch + Transformers 4.46 + DeepSeek-OCR
- Server: Nginx (reverse proxy)
- Container: Docker + Docker Compose with multi-stage builds
- GPU: AMD ROCm 6.1 support (tested on Radeon PRO W7800)
deepseek-ocr/
├── backend/ # FastAPI backend
│ ├── main.py
│ ├── requirements.txt
│ └── Dockerfile
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/
│ │ ├── App.jsx
│ │ └── main.jsx
│ ├── package.json
│ ├── nginx.conf
│ └── Dockerfile
├── models/ # Model cache
└── docker-compose.yml
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --host 0.0.0.0 --port 8000cd frontend
npm install
npm run dev- Docker & Docker Compose
- AMD GPU with ROCm 6.1 support (tested on Radeon PRO W7800)
- ROCm drivers/runtime on the host (
/dev/kfd&/dev/driexposed to containers) - ~8-12GB VRAM for model
- 📦 Find mode grounding boxes: Not rendering correctly - likely dimension scaling issue in the canvas overlay logic. Boxes are detected and returned by the backend, but the frontend visualization needs work.
- The backend container is built from
rocm/pytorch:rocm6.1_ubuntu22.04_py3.10_pytorch_2.5.1, so no extra PyTorch install steps are required. - Ensure the host user has access to
/dev/kfdand/dev/dri. Adding your user to thevideoandrendergroups usually does the trick. - If your GPU reports an older GFX IP, set
HSA_OVERRIDE_GFX_VERSIONin.envor the compose file (for example11.0.0for RDNA3). - Override
TORCH_DEVICEorTORCH_DTYPEenvironment variables if you need to force a specific device/dtype (defaults are auto-detected).
Parameters:
image(file, required)mode(string): plain_ocr | describe | find_ref | freeformprompt(string): Custom prompt for freeform modegrounding(bool): Enable bounding boxes (auto-enabled for find_ref)find_term(string): Term to locate in find_ref modebase_size(int): Base processing size (default: 1024)image_size(int): Image size (default: 640)crop_mode(bool): Enable crop mode (default: true)
Response:
{
"success": true,
"text": "Extracted text...",
"boxes": [{"label": "field", "box": [x1, y1, x2, y2]}],
"image_dims": {"w": 1920, "h": 1080},
"metadata": {...}
}rocminfo
docker run --rm --device=/dev/kfd --device=/dev/dri --group-add video --group-add render rocm/pytorch:rocm6.1_ubuntu22.04_py3.10_pytorch_2.5.1 rocminfosudo lsof -i :3000
sudo lsof -i :8000cd frontend
rm -rf node_modules package-lock.json
docker-compose build frontendThis project uses the DeepSeek-OCR model. Refer to the model's license terms.