diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..3cd6da4 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include manga_ocr/assets/*.jpg diff --git a/README.md b/README.md index 9308046..7e2a76a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,18 @@ +OCR for Japanese manga + +# Installation + +You need Python 3.6+. + +If you want to run with GPU, install PyTorch as described [here](https://pytorch.org/get-started/locally/#start-locally), +otherwise this step can be skipped. + +Run: + +``` +pip install manga-ocr +``` + # Usage ```python diff --git a/assets/crop.png b/assets/crop.png deleted file mode 100644 index b6ba3a3..0000000 Binary files a/assets/crop.png and /dev/null differ diff --git a/manga_ocr/__init__.py b/manga_ocr/__init__.py index 65120cf..91bf945 100644 --- a/manga_ocr/__init__.py +++ b/manga_ocr/__init__.py @@ -1 +1,3 @@ +__version__ = '0.1.1' + from manga_ocr.ocr import MangaOcr diff --git a/manga_ocr/run.py b/manga_ocr/__main__.py similarity index 99% rename from manga_ocr/run.py rename to manga_ocr/__main__.py index 9849dd1..ac70c37 100644 --- a/manga_ocr/run.py +++ b/manga_ocr/__main__.py @@ -92,5 +92,9 @@ def run( time.sleep(delay_secs) -if __name__ == '__main__': +def main(): fire.Fire(run) + + +if __name__ == '__main__': + main() diff --git a/manga_ocr/assets/example.jpg b/manga_ocr/assets/example.jpg new file mode 100644 index 0000000..1c0ad4a Binary files /dev/null and b/manga_ocr/assets/example.jpg differ diff --git a/manga_ocr/ocr.py b/manga_ocr/ocr.py index c350d7f..b13dced 100644 --- a/manga_ocr/ocr.py +++ b/manga_ocr/ocr.py @@ -21,7 +21,7 @@ class MangaOcr: else: logger.info('Using CPU') - self(Path(__file__).parent.parent / 'assets/crop.png') + self(Path(__file__).parent / 'assets/example.jpg') logger.info('OCR ready') diff --git a/requirements.txt b/requirements.txt index 2cdbb57..10391f8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,10 @@ fire +fugashi jaconv loguru numpy Pillow pyperclip -torch +torch>=1.0 transformers>=4.12.5 +unidic_lite diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..1b2034d --- /dev/null +++ b/setup.py @@ -0,0 +1,38 @@ +from pathlib import Path +from setuptools import setup + +long_description = (Path(__file__).parent / "README.md").read_text().split('# Installation')[0] + +setup( + name="manga-ocr", + version='0.1.1', + description="OCR for Japanese manga", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/kha-white/manga_ocr", + author="Maciej Budyƛ", + author_email="kha-white@mail.com", + license="Apache License 2.0", + classifiers=[ + "Programming Language :: Python :: 3", + ], + packages=['manga_ocr'], + include_package_data=True, + install_requires=[ + "fire", + "fugashi", + "jaconv", + "loguru", + "numpy", + "Pillow", + "pyperclip", + "torch>=1.0", + "transformers>=4.12.5", + "unidic_lite", + ], + entry_points={ + "console_scripts": [ + "manga_ocr=manga_ocr.__main__:main", + ] + }, +)