1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 hdf5,
7 numpy,
8 opencv-python-headless,
9 pillow,
10 pyaml,
11 pyclipper,
12 python-bidi,
13 pythonOlder,
14 scikit-image,
15 scipy,
16 shapely,
17 torch,
18 torchvision,
19 python,
20}:
21
22buildPythonPackage rec {
23 pname = "easyocr";
24 version = "1.7.2";
25 pyproject = true;
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchFromGitHub {
30 owner = "JaidedAI";
31 repo = "EasyOCR";
32 tag = "v${version}";
33 hash = "sha256-9mrAxt2lphYtLW81lGO5SYHsnMnSA/VpHiY2NffD/Js=";
34 };
35
36 build-system = [
37 setuptools
38 ];
39
40 pythonRelaxDeps = [
41 "torchvision"
42 ];
43
44 pythonRemoveDeps = [
45 "ninja"
46 ];
47
48 dependencies = [
49 hdf5
50 numpy
51 opencv-python-headless
52 pillow
53 pyaml
54 pyclipper
55 python-bidi
56 scikit-image
57 scipy
58 shapely
59 torch
60 torchvision
61 ];
62
63 checkPhase = ''
64 runHook preCheck
65
66 export HOME="$(mktemp -d)"
67 pushd unit_test
68 ${python.interpreter} run_unit_test.py --easyocr "$out/${python.sitePackages}/easyocr"
69 popd
70
71 runHook postCheck
72 '';
73
74 # downloads detection model from the internet
75 doCheck = false;
76
77 pythonImportsCheck = [ "easyocr" ];
78
79 meta = with lib; {
80 description = "Ready-to-use OCR with 80+ supported languages and all popular writing scripts";
81 mainProgram = "easyocr";
82 homepage = "https://github.com/JaidedAI/EasyOCR";
83 changelog = "https://github.com/JaidedAI/EasyOCR/releases/tag/v${version}";
84 license = licenses.asl20;
85 maintainers = with maintainers; [ dit7ya ];
86 };
87}