diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8fa5b33 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4a4ceb3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python +LABEL maintainer="Narate Ketram " +WORKDIR /app +RUN apt-get update && \ + apt-get install -y tesseract-ocr libtesseract-dev imagemagick ghostscript +ADD requirements.txt . +RUN pip install -r requirements.txt + +ADD . . +EXPOSE 5000 +CMD ["python", "main.py"] diff --git a/README.md b/README.md index ebf51b7..4bed5d4 100644 --- a/README.md +++ b/README.md @@ -14,5 +14,24 @@ Run the respective python scripts for respective use-cases. * Pillow (For Image Processing) * [ImageMagick](https://legacy.imagemagick.org/script/binary-releases.php#windows) * wand(Python binding for ImageMagick) + +## Run in Docker + +First build docker image +``` +docker build -t ocr . +``` + +Run Docker container +``` +docker run -it --rm -p 5000:5000 ocr +``` + +Or run using docker-compose + +``` +docker-compose up +``` + *** **[Tesseract](https://github.com/tesseract-ocr/tesseract)** was originally written in C++ and uses an LSTM Network behind the scenes, for more reading and installation guide, you can check out this very helpful [blog post](https://appliedmachinelearning.blog/2018/06/30/performing-ocr-by-running-parallel-instances-of-tesseract-4-0-python/). This will explain you the essential stuff. I have also extended this for PDFs to make it more useful for real-world use-case. diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..9e46718 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,6 @@ +version: '3.7' +services: + ocr: + build: . + ports: + - 5000:5000 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 8e15f17..daac1ba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,6 @@ ItsDangerous==1.0.0 Jinja2==2.10 MarkupSafe==1.0 Pillow==5.3.0 -pkg-resources==0.0.0 pytesseract==0.2.5 Wand==0.4.4 Werkzeug==0.14.1