A simple OCR API server, seriously easy to be deployed by Docker, on Heroku as well

Overview

ocrserver

Go CI codecov Go Report Card

Simple OCR server, as a small working sample for gosseract.

Try now here https://ocr-example.herokuapp.com/, and deploy your own now.

Deploy to Heroku

# Get the code
% git clone [email protected]:otiai10/ocrserver.git
% cd ocrserver
# Make your app
% heroku login
% heroku create
# Deploy the container
% heroku container:login
% heroku container:push web
# Enjoy it!
% heroku open

cf. heroku cli

Quick Start

Ready-Made Docker Image

% docker run -p 8080:8080 otiai10/ocrserver
# open http://localhost:8080

cf. docker

Development with Docker Image

% docker-compose up
# open http://localhost:8080

You need more languages?

% docker-compose build --build-arg LOAD_LANG=rus
% docker-compose up

cf. docker-compose

Manual Setup

If you have tesseract-ocr and library files on your machine

% go get github.com/otiai10/ocrserver/...
% PORT=8080 ocrserver
# open http://localhost:8080

cf. gosseract

Documents

Comments
  • The OCR results on the local machine are not the same as your demo website.

    The OCR results on the local machine are not the same as your demo website.

    I try to read the image on my local machine, but the result is bad: image But it is perfect on your demo website: image I don't know why, did you use any trained model for that?

    opened by leowilbur 6
  • Any plan to use gosseract develop branch for saving init cost?

    Any plan to use gosseract develop branch for saving init cost?

    I found that this client's init method cost a lot of time while using ocrserver. Any plan to use gosseract develop branch for saving init cost, or some suggestions for me?

    opened by wangsongyan 3
  • fail to run main.go

    fail to run main.go

    Hello

    i get the following error when running the code:

    github.com/otiai10/gosseract/v2

    cc1.exe: sorry, unimplemented: 64-bit mode not compiled in

    #reprdocuceable every time

    go env
    

    set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\BlackPearl\AppData\Local\go-build set GOENV=C:\Users\BlackPearl\AppData\Roaming\go\env set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE=C:\Users\BlackPearl\go\pkg\mod set GONOPROXY= set GONOSUMDB= set GOOS=windows set GOPATH=C:\go set GOPRIVATE= set GOPROXY=https://proxy.golang.org,direct set GOROOT=c:\go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLDIR=c:\go\pkg\tool\windows_amd64 set GCCGO=gccgo set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD= set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\BLACKP~1\AppData\Local\Temp\go-build118439850=/tmp/go-build -gno-record-gcc-switches

    go version
    

    go version go1.15.6 windows/amd64

    tesseract --version
    

    tesseract v4.0.0.20190314 leptonica-1.78.0 libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.5.3) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 : libwebp 0.6.1 : libopenjp2 2.2.0 Found AVX2 Found AVX Found SSE

    no reply 
    opened by damn-at 2
  • docker  quick start ,whilelist isn't working!

    docker quick start ,whilelist isn't working!

    docker quick start ,whilelist isn't working! this simple "https://ocr-example.herokuapp.com/" is well. from docker pull image. do not working

    bug 
    opened by wuxue107 2
  • stdlib.h: No such file or directory

    stdlib.h: No such file or directory

    I have a Ubuntu Server VM as I hate Docker, the machine is clean and created with the following commands:

    #Install go rm -r /temp &&
    mkdir /temp &&
    cd /temp &&
    wget https://dl.google.com/go/go1.13.7.linux-amd64.tar.gz &&
    tar -xvf go1.13.7.linux-amd64.tar.gz &&
    mv go /usr/local &&
    cd / &&
    rm -r /temp &&
    export GOROOT=/usr/local/go &&
    export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

    #Install libs #2 - Lib installation apt-get install -y
    tesseract-ocr-all
    libtesseract-dev
    imagemagick
    libleptonica-dev
    gcc

    So when: go get github.com/otiai10/ocrserver/...

    The following error is thrown: image

    PD:

    1. Tesseract does work individually as I can use the command line to interact with it
    2. Go does work properly as I tested an hello world from git
    opened by Zarovzky 2
  • Setting language via http.request

    Setting language via http.request

    Hi,

    I think your project is great and I like the Docker solution very much. however, I just can't get it to change the language in the header at the moment.

    Would you have a tip for me how I could change this?

    I already tried with Header.Add and writer.CreateFormField("languages") without success.

    Thanks a lot

    `file, _ := os.Open(datei) defer file.Close()

    body := new(bytes.Buffer)
    writer := multipart.NewWriter(body)
    part2, err := writer.CreateFormField("languages")
    part, _ := writer.CreateFormFile("file", filepath.Base(file.Name()))
    
    if err != nil {
    	fmt.Printf("Error creatformfield: %s", err)
    }
    
    part2.Write([]byte("deu"))
    io.Copy(part, file)
    writer.Close()
    
    r, _ := http.NewRequest("POST", "http://10.6.0.3:9080/file", body)
    //r.Header.Add("languages", "deu")
    //r.Header.Set("languages", "deu")
    r.Header.Add("Content-Type", writer.FormDataContentType())
    
    opened by schabil 1
  • CORS not working

    CORS not working

    I deployed this container to Heroku and sending POST requests via curl works great! However, I have trouble getting POST requests via a React web app due to CORS. What is the best way to enable CORS on this project, since it implements the request endpoints using marmoset? Thank you!

    opened by emersonhsieh 1
  • load languages option in Dockerfile should just be tesseract-ocr-all

    load languages option in Dockerfile should just be tesseract-ocr-all

    It would be more useful for the demonstrator docker-compose up version to just install all languages (tesseract-ocr-all) instead of tessseract-ocr-jpn. If anything, it should be included in the readme how to change the Dockerfile to install all languages.

    opened by james-see 1
  • want to get the version of tesseract-ocr

    want to get the version of tesseract-ocr

    when i run this project on my windows computer, i got a result that be diffrent from to your site(https://ocr-example.herokuapp.com/), i want to find the reason, maybe is tesseract-ocr version or traindata

    0_0 QQ截图20190508160952 QQ截图20190508161024

    opened by wangsongyan 1
  • Optimize Dokcerfile

    Optimize Dokcerfile

    Optimize Dockerfile, modify goproxy, LOAD_LANG, and run build file on scratch. Old image size is about 800+M, optimize image size is about 9M, and it doesn't have bash , only used as a web service.

    opened by RocsSun 0
  • Optimize Dockerfile

    Optimize Dockerfile

    Optimize Dockerfile.

    Optimize Dockerfile. Old dockerfile build image size is about 800+M,this docker file build image size is about 200M, if use alpine base image, build image size is about 160M, and test pass. dockerhub repositories at redsun/ocr-server.

    opened by RocsSun 1
Owner
Hiromu OCHIAI
🙋 ❤️ 🍣
Hiromu OCHIAI
🚀 fgprof is a sampling Go profiler that allows you to analyze On-CPU as well as Off-CPU (e.g. I/O) time together.

?? fgprof - The Full Go Profiler fgprof is a sampling Go profiler that allows you to analyze On-CPU as well as Off-CPU (e.g. I/O) time together. Go's

Felix Geisendörfer 2.4k Dec 31, 2022
Bcfm-study-case - A simple http server using the Echo library in Go language

Task 1 Hakkında Burada Go dilinde Echo kütüphanesini kullanarak basit bir http s

Caner Gülay 0 Feb 2, 2022
Go Scoring API for PMML

Goscore Go scoring API for Predictive Model Markup Language (PMML). Currently supports Neural Network, Decision Tree, Random Forest and Gradient Boost

Asaf Schers 84 Dec 24, 2022
go-paddle is a Go client library for accessing the Paddle API.

go-paddle go-paddle is a Go client library for accessing the Paddle API. Installation go get github.com/Fakerr/go-paddle Alternatively the same can be

Walid Berrahal 8 Aug 22, 2022
Suricate-bank - API to transfer money between accounts at Suricate Bank,written in Go

⚠️ WORK IN PROGRESS ⚠️ Suricate Bank is an api that creates accounts and transfe

João Saraceni 12 Oct 8, 2022
Go-hubspot - An auto-generated go client library of all of Hubspot's API

go-hubspot This is an auto-generated go client library of all of Hubspot's API (

Fae 0 Jan 22, 2022
Fast, simple sklearn-like feature processing for Go

go-featureprocessing Fast, simple sklearn-like feature processing for Go Does not cross cgo boundary No memory allocation No reflection Convenient ser

Nikolay Dubina 89 Dec 2, 2022
a simple & tiny scrapy clustering solution, considered a drop-in replacement for scrapyd

scrapyr a very simple scrapy orchestrator engine that could be distributed among multiple machines to build a scrapy cluster, under-the-hood it uses r

Mohammed Al Ashaal 50 Nov 24, 2021
Simple gc using integer vectors to simulate

gcint Simple gc using integer vectors to simulate Iterate primarily over what should be the shorter vector (readers) removing unused references in fro

Matt Rutkowski 0 Nov 24, 2021
A simple utility, written in Go, for interacting with Salesforce.

Salesforce CLI A simple utility, written in Go, for interacting with Salesforce. Currently only specific functionality is implemented, and the output

Darren Parkinson 0 Dec 14, 2021
A simple yet customisable program written in go to make hackerman-like terminal effects.

stuntman a simple program written in go to make you look like a hackerman Demo stuntman -binar -width 90 -color cyan stuntman -text -width 90 -vertgap

Solaris 10 Aug 4, 2022
Web app built with Go/Golang and Buffalo, deployed on Heroku, using Heroku Postgres

hundred-go-buffalo Background Read Go Read Buffalo Read Getting Started on Heroku with Go Recommended Tools PowerShell terminal Chocolatey Windows pac

Denise Case 0 Dec 18, 2021
Simple CLI util for running OCR on images through PERO OCR API

pero_ocr Simple CLI util for running OCR on images through PERO OCR API Usage: Usage of batch_pero_ocr: -c string cancel request with given

Moravian Library in Brno 2 Dec 1, 2021
A barebones Go app, which can easily be deployed to Heroku

go-getting-started A barebones Go app, which can easily be deployed to Heroku. This application supports the Getting Started with Go on Heroku article

Chamod Jayampathi 0 Nov 29, 2021
A web app written in Go, using Auth0 and deployed to Heroku

hundred-go This project demonstrates a web app written in Go that uses free Auth0 for authentication and authorization. Web Apps - Plan for Auth Early

Denise Case 0 Dec 22, 2021
An easy-to-use OCR and Japanese to English translation tool

Manga Translator An easy-to-use application for translating text in images from Japanese to English. The GUI was created using Gio. Gio supports a var

Cameron Kinsella 53 Dec 28, 2022
REST API written in GO with PostgreSQL and Nginx Proxy + Certbot Let's Encrypt HTTPS certificates + Graphical Frontend in PHP. Deployed via docker-compose.

SSOA-PT REST APP Services Backend: REST API in Go Database: PostgreSQL Web Proxy: Nginx Let's Encrypt HTTPS certificates with certbot Frontend: PHP Ap

null 0 Mar 19, 2022
Go-http-server-docker - Simple sample server using docker and go

go-http-server-docker Simple sample webserver using docker and go.

null 0 Jan 8, 2022
Go module for communicating with the Veryfi OCR API

veryfi-go is a Go module for communicating with the Veryfi OCR API Installing This package can be installed by cloning this directory: git clone https

Veryfi 21 Jan 5, 2023
A docker container that can be deployed as a sidecar on any kubernetes pod to monitor PSI metrics

CgroupV2 PSI Sidecar CgroupV2 PSI Sidecar can be deployed on any kubernetes pod with access to cgroupv2 PSI metrics. About This is a docker container

null 1 Nov 23, 2021