Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
env
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python
LABEL maintainer="Narate Ketram <koonnarate@gmail.com>"
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"]
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
6 changes: 6 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '3.7'
services:
ocr:
build: .
ports:
- 5000:5000
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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