This repository contains OCR Service built using Axum.
The full list of crates used can be found in the Cargo.toml file. However, here are some key ones:
- axum - A user-friendly, modular web framework built with Tokio, Tower, and Hyper.
- tesseract-rs - A library for OCR using Tesseract Rust bindings.
- image - An image processing library for Rust.
- Insta - A library for snapshot testing in Rust.
- utoipa - A library for generating OpenAPI documentation in Rust.
- opentelemetry-rust - OpenTelemetry for Rust.
You can use the .env.example file or src/config/app_config.rs to view and configure the application.
The OCR Service requires the Tesseract data files to be downloaded into the tesseract directory. You can download the files manually via these repositories:
Or by running the scripts/download-tessdata.sh script.
With everything else set up, all you need to do now is:
cargo run
Run tests:
cargo test
Run Snapshot tests:
cargo insta test
Run and review Snapshot tests:
cargo insta test --review
Run Clippy:
cargo clippy
Run Rustfmt:
cargo fmt
For building and running the docker image locally:
docker build -t ocr-service .
docker run -p 8080:8080 ocr-service
The API documentation is available at http://localhost:8080/api-docs when running locally.
Send a file to the /api/v1/images
endpoint to process the image.
curl -X POST -F "image=@./tests/images/tessdoc-introduction.png" \
http://localhost:8080/api/v1/images
curl http://localhost:8080/health