python3Packages.manga-ocr: init at 0.1.11
This commit is contained in:
parent
41facdabeb
commit
069df9cb6a
65
pkgs/development/python-modules/manga-ocr/default.nix
Normal file
65
pkgs/development/python-modules/manga-ocr/default.nix
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
fetchFromGitHub,
|
||||||
|
buildPythonPackage,
|
||||||
|
fire,
|
||||||
|
fugashi,
|
||||||
|
jaconv,
|
||||||
|
loguru,
|
||||||
|
numpy,
|
||||||
|
pillow,
|
||||||
|
pyperclip,
|
||||||
|
torch,
|
||||||
|
transformers,
|
||||||
|
unidic-lite,
|
||||||
|
pythonOlder,
|
||||||
|
}:
|
||||||
|
buildPythonPackage rec {
|
||||||
|
pname = "manga-ocr";
|
||||||
|
version = "0.1.11";
|
||||||
|
disabled = pythonOlder "3.7";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "kha-white";
|
||||||
|
repo = pname;
|
||||||
|
rev = "refs/tags/v${version}";
|
||||||
|
hash = "sha256-cLmgHBt6HvhY6Hb9yQ425Gk181axnMr+Mp2LxSmPoDg=";
|
||||||
|
};
|
||||||
|
|
||||||
|
preBuild = ''
|
||||||
|
# remove subproject dedicated to model training
|
||||||
|
rm -rf manga_ocr_dev
|
||||||
|
# copy assets/example.jpg inside the package
|
||||||
|
# required by https://github.com/kha-white/manga-ocr/blob/ba1b0d94a8ef6676b618ba4e5ffe8ce2ab655270/manga_ocr/ocr.py#L27-L30
|
||||||
|
# see also package_data.patch
|
||||||
|
mkdir manga_ocr/assets
|
||||||
|
cp assets/example.jpg manga_ocr/assets/example.jpg
|
||||||
|
'';
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
# instruct setuptool to copy assets/example.jpg to package when building wheel
|
||||||
|
./package_data.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
# taken from requirements.txt
|
||||||
|
fire
|
||||||
|
fugashi
|
||||||
|
jaconv
|
||||||
|
loguru
|
||||||
|
numpy
|
||||||
|
pillow
|
||||||
|
pyperclip
|
||||||
|
torch
|
||||||
|
transformers
|
||||||
|
unidic-lite
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Optical character recognition for Japanese text, with the main focus being Japanese manga";
|
||||||
|
homepage = "https://github.com/kha-white/manga-ocr";
|
||||||
|
changelog = "https://github.com/kha-white/manga-ocr/releases/tag/${version}";
|
||||||
|
license = licenses.asl20;
|
||||||
|
maintainers = with maintainers; [laurent-f1z1];
|
||||||
|
};
|
||||||
|
}
|
12
pkgs/development/python-modules/manga-ocr/package_data.patch
Normal file
12
pkgs/development/python-modules/manga-ocr/package_data.patch
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -18,6 +18,9 @@ setup(
|
||||||
|
],
|
||||||
|
packages=['manga_ocr'],
|
||||||
|
include_package_data=True,
|
||||||
|
+ package_data={
|
||||||
|
+ 'manga_ocr': ['assets/example.jpg'],
|
||||||
|
+ },
|
||||||
|
install_requires=[
|
||||||
|
"fire",
|
|
@ -7092,6 +7092,8 @@ self: super: with self; {
|
||||||
|
|
||||||
mandown = callPackage ../development/python-modules/mandown { };
|
mandown = callPackage ../development/python-modules/mandown { };
|
||||||
|
|
||||||
|
manga-ocr = callPackage ../development/python-modules/manga-ocr { };
|
||||||
|
|
||||||
manhole = callPackage ../development/python-modules/manhole { };
|
manhole = callPackage ../development/python-modules/manhole { };
|
||||||
|
|
||||||
manimpango = callPackage ../development/python-modules/manimpango {
|
manimpango = callPackage ../development/python-modules/manimpango {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user