Skip to content
Merged
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
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,18 @@ RUN pip install flashtext && \
pip install flask && \
# pycrypto is used by competitions team.
pip install pycrypto && \
pip install easyocr && \
/tmp/clean-layer.sh

# Download base easyocr models.
# https://github.com/JaidedAI/EasyOCR#usage
RUN mkdir -p /root/.EasyOCR/model && \
wget --no-verbose "https://github.com/JaidedAI/EasyOCR/releases/download/pre-v1.1.6/latin.zip" -O /root/.EasyOCR/model/latin.zip && \
unzip /root/.EasyOCR/model/latin.zip -d /root/.EasyOCR/model/ && \
rm /root/.EasyOCR/model/latin.zip && \
wget --no-verbose "https://github.com/JaidedAI/EasyOCR/releases/download/pre-v1.1.6/craft_mlt_25k.zip" -O /root/.EasyOCR/model/craft_mlt_25k.zip && \
unzip /root/.EasyOCR/model/craft_mlt_25k.zip -d /root/.EasyOCR/model/ && \
rm /root/.EasyOCR/model/craft_mlt_25k.zip && \
/tmp/clean-layer.sh

# Tesseract and some associated utility packages
Expand Down
Binary file added tests/data/english.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions tests/test_easyocr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import unittest

import easyocr

class TestEasyOCR(unittest.TestCase):
def test_readtext(self):
# The model_storage_directory is only need in tests where we overwrite HOME=/tmp
reader = easyocr.Reader(['en'], gpu=False, model_storage_directory='/root/.EasyOCR/model')
result = reader.readtext('/input/tests/data/english.png', detail = 0)
# ['Reduce your risk of coronavirus infection:', 'Clean hands with soap and water',
# 'or alcohol based hand rub', 'Cover nose and mouth when coughing and',
# 'sneezing with tissue or flexed elbow', 'Avoid close contact with anyone with',
# 'cold or flu like symptoms', 'Thoroughly cook meat and eggs',
# 'No unprotected contact with live wild', 'or farm animals', 'World Health', 'Organization']
self.assertEqual(len(result), 12)