Git Product home page Git Product logo

pyopenocr's Introduction

PyOpenOCR makes it simple to host your own OCR REST API.

The heavy lifting OCR work is handled by Tesseract 4 OCR.

Run the service in your own computer or use Docker to containerize.

Features

  • Scalable as a stateless app.
  • Platform independence via Docker containers.
  • TODO: Kubernetes
  • HTTPS out of the box
  • Supports 31 languages in addition to English
  • Pass arguments to Tesseract such as character whitelist and page segment mode.
  • REST API docs

Launching PyOpenOCR in Docker

  • Install docker
  • git clone https://github.com/gabrielpsilva/pyopenocr.git
  • cd pyopenocr
  • Type ./run_docker.sh (in case you don't have execute right type sudo chmod +x run.sh

Launching PyOpenOCR locally (Centos, RedHat or Fedora)

  • git clone https://github.com/gabrielpsilva/pyopenocr.git
  • cd pyopenocr
  • Type ./run_native.sh (in case you don't have execute right type sudo chmod +x run.sh

In Tesseract 4.00 The memory usage is light. It is less fast than tesseract 3 and more costly in term of size (an simple aws instance with 1GB of ram is sufficient but with an EBS of 16GB of storage). Result are really better compared to version 3.04. To see a comparative you can have a look to the official page of tesseract

You are now ready to decode images โ†’ text via your REST API.

Request with image base64

#convert image to base 64
$ base64 image_test.png > /tmp/image_test.png.txt
$ curl -k -X POST https://localhost:443/ocr-base64 \
  -H "Content-Type: text/plain" \
  -d "@/tmp/image_test.png.txt"

Request with image URL

$curl -k -X POST https://localhost:443/ocr-url \
  -H "Content-Type: text/plain" \
  -d "https://github.com/gabrielpsilva/pyopenocr/blob/master/image_test.png"

Passing parameters to Tesseract

You can pass parameters using in the url request: $curl -k -X POST https://localhost:443/ocr-base64?psm=2&oem=3&lang=eng
-H "Content-Type: text/plain"
-d "https://github.com/gabrielpsilva/pyopenocr/blob/master/image_test.png"

License

PyOpenOCR is Open Source and available under the Apache 2 License.

pyopenocr's People

Contributors

gabepsilva avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.