1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hdf5,
6 numpy,
7 onnx,
8 opencv4,
9 pillow,
10 pyaml,
11 pyclipper,
12 python-bidi,
13 pythonOlder,
14 scikit-image,
15 scipy,
16 shapely,
17 torch,
18 torchvision,
19}:
20
21buildPythonPackage rec {
22 pname = "easyocr";
23 version = "1.7.1";
24 format = "setuptools";
25
26 disabled = pythonOlder "3.7";
27
28 src = fetchFromGitHub {
29 owner = "JaidedAI";
30 repo = "EasyOCR";
31 rev = "refs/tags/v${version}";
32 hash = "sha256-EiiJ2LJ3uYIvgPd2y25MraV5kTa47JalDR7SLbkM9UI=";
33 };
34
35 postPatch = ''
36 substituteInPlace requirements.txt \
37 --replace "opencv-python-headless" "" \
38 --replace "ninja" ""
39 '';
40
41 propagatedBuildInputs = [
42 hdf5
43 numpy
44 opencv4
45 pillow
46 pyaml
47 pyclipper
48 python-bidi
49 scikit-image
50 scipy
51 shapely
52 torch
53 torchvision
54 ];
55
56 nativeCheckInputs = [ onnx ];
57
58 pythonImportsCheck = [ "easyocr" ];
59
60 meta = with lib; {
61 description = "Ready-to-use OCR with 80+ supported languages and all popular writing scripts";
62 mainProgram = "easyocr";
63 homepage = "https://github.com/JaidedAI/EasyOCR";
64 changelog = "https://github.com/JaidedAI/EasyOCR/releases/tag/v${version}";
65 license = licenses.asl20;
66 maintainers = with maintainers; [ dit7ya ];
67 };
68}