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