Skip to content

Commit

Permalink
Merge branch 'zyddnys:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
My12123 authored Nov 14, 2023
2 parents 51a7e1b + 11b3a39 commit 2f61708
Show file tree
Hide file tree
Showing 50 changed files with 5,769 additions and 839 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on:
push:
branches: [main]
paths:
- '.github/workflows/ci.yml'
- 'manga_translator/**'
- 'test/**'
- 'pyproject.toml'
- 'poetry.lock'
pull_request:
branches: [main]
paths:
- '.github/workflows/ci.yml'
- 'manga_translator/**'
- 'test/**'
- 'pyproject.toml'
- 'poetry.lock'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
poetry-version: [1.6.1]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry ${{ matrix.poetry-version }}
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
poetry install --only main,test
- name: Lint *.py files
run: |
poetry run pylint $(git ls-files '*.py')
# - name: Test
# run: |
# poetry run pytest test
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,23 @@ Scripts
Lib
include
share

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelogs

### 2023-11-11

1. Added new OCR model `48px`

### 2023-05-08

1. Added [4x-UltraSharp](https://mega.nz/folder/qZRBmaIY#nIG8KyWFcGNTuMX_XNbJ_g) upscaler
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG_CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 更新日志 (中文)

### 2023-11-11

1. 添加了新的OCR模型`48px`

### 2023-05-08

1. 添加了[4x-UltraSharp](https://mega.nz/folder/qZRBmaIY#nIG8KyWFcGNTuMX_XNbJ_g)超分辨率
Expand Down
155 changes: 120 additions & 35 deletions README.md

Large diffs are not rendered by default.

46 changes: 31 additions & 15 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ ESP: Spanish
TRK: Turkish
VIN: Vietnames
ARA: Arabic
SRP: Serbian
HRV: Croatian
THA: Thai
```
<!-- Auto generated start (See devscripts/make_readme.py) -->
Expand All @@ -111,20 +114,28 @@ ARA: Arabic
image folder if using batch mode
-o, --dest DEST Path to the destination folder for translated images in
batch mode
-l, --target-lang {CHS,CHT,CSY,NLD,ENG,FRA,DEU,HUN,ITA,JPN,KOR,PLK,PTB,ROM,RUS,ESP,TRK,UKR,VIN,ARA}
-l, --target-lang {CHS,CHT,CSY,NLD,ENG,FRA,DEU,HUN,ITA,JPN,KOR,PLK,PTB,ROM,RUS,ESP,TRK,UKR,VIN,ARA,CNR,SRP,HRV,THA,IND}
Destination language
-v, --verbose Print debug info and save intermediate images in result
folder
-f, --format {png,webp,jpg,xcf,psd,pdf} Output format of the translation.
--attempts ATTEMPTS Retry attempts on encountered error. -1 means infinite
times.
--ignore-errors Skip image on encountered error.
--overwrite Overwrite already translated images in batch mode.
--skip-no-text Skip image without text (Will not be saved).
--model-dir MODEL_DIR Model directory (by default ./models in project root)
--use-cuda Turn on/off cuda
--use-cuda-limited Turn on/off cuda (excluding offline translator)
--detector {default,ctd,craft,none} Text detector used for creating a text mask from an
image, DO NOT use craft for manga, it's not designed
for it
--ocr {32px,48px_ctc} Optical character recognition (OCR) model to use
--inpainter {default,lama_mpe,sd,none,original}
--ocr {48px,32px,48px_ctc} Optical character recognition (OCR) model to use
--inpainter {default,lama_large,lama_mpe,sd,none,original}
Inpainting model to use
--upscaler {waifu2x,esrgan,4xultrasharp} Upscaler to use. --upscale-ratio has to be set for it
to take effect
--upscale-ratio {1,2,3,4,8,16,32} Image upscale ratio applied before detection. Can
--upscale-ratio UPSCALE_RATIO Image upscale ratio applied before detection. Can
improve text detection.
--colorizer {mc2} Colorization model to use.
--translator {google,youdao,baidu,deepl,papago,caiyun,gpt3,gpt3.5,gpt4,none,original,offline,nllb,nllb_big,sugoi,jparacrawl,jparacrawl_big,m2m100,m2m100_big}
Expand All @@ -136,13 +147,6 @@ ARA: Arabic
image. Note the first translation service acts as
default if the language isnt defined. Example:
--translator-chain "google:JPN;sugoi:ENG".
--use-cuda Turn on/off cuda
--use-cuda-limited Turn on/off cuda (excluding offline translator)
--model-dir MODEL_DIR Model directory (by default ./models in project root)
--attempts ATTEMPTS Retry attempts on encountered error. -1 means infinite
times.
--ignore-errors Skip image on encountered error.
--overwrite Overwrite already translated images in batch mode.
--revert-upscaling Downscales the previously upscaled image after
translation back to original size (Use with --upscale-
ratio).
Expand All @@ -161,27 +165,39 @@ ARA: Arabic
--min-text-length MIN_TEXT_LENGTH Minimum text length of a text region
--inpainting-size INPAINTING_SIZE Size of image used for inpainting (too large will
result in OOM)
--inpainting-precision INPAINTING_PRECISION Inpainting precision for lama,
use bf16 while you can.
--colorization-size COLORIZATION_SIZE Size of image used for colorization. Set to -1 to use
full image size
--denoise-sigma DENOISE_SIGMA Used by colorizer and affects color strength, range
from 0 to 255 (default 30). -1 turns it off.
--mask-dilation-offset MASK_DILATION_OFFSET By how much to extend the text mask to remove left-over
text pixels of the original image.
--font-size FONT_SIZE Use fixed font size for rendering
--font-size-offset FONT_SIZE_OFFSET Offset font size by a given amount, positive number
increase font size and vice versa
--font-size-minimum FONT_SIZE_MINIMUM Minimum output font size. Default is
image_sides_sum/150
image_sides_sum/200
--font-color FONT_COLOR Overwrite the text fg/bg color detected by the OCR
model. Use hex string without the "#" such as FFFFFF
for a white foreground or FFFFFF:000000 to also have a
black background around the text.
--line-spacing LINE_SPACING Line spacing is font_size * this value. Default is 0.01
for horizontal text and 0.2 for vertical.
--force-horizontal Force text to be rendered horizontally
--force-vertical Force text to be rendered vertically
--align-left Align rendered text left
--align-center Align rendered text centered
--align-right Align rendered text right
--uppercase Change text to uppercase
--lowercase Change text to lowercase
--no-hyphenation If renderer should be splitting up words using a hyphen
character (-)
--manga2eng Render english text translated from manga with some
additional typesetting. Ignores some other argument
options
--gpt-config GPT_CONFIG Path to GPT config file, more info in README
--mtpe Turn on/off machine translation post editing (MTPE) on
--use-mtpe Turn on/off machine translation post editing (MTPE) on
the command line (works only on linux right now)
--save-text Save extracted text and translations into a text file.
--save-text-file SAVE_TEXT_FILE Like --save-text but with a specified file path.
Expand All @@ -191,7 +207,7 @@ ARA: Arabic
inpainted images, plus copies of the original for
reference
--font-path FONT_PATH Path to font file
--gimp-font FONT_FAMILY Font family to use for gimp rendering.
--gimp-font GIMP_FONT Font family to use for gimp rendering.
--host HOST Used by web module to decide which host to attach to
--port PORT Used by web module to decide which port to attach to
--nonce NONCE Used by web module as secret for securing internal web
Expand All @@ -201,7 +217,7 @@ ARA: Arabic
100 being best
--ignore-bubble IGNORE_BUBBLE The threshold for ignoring text in non bubble areas,
with valid values ranging from 1 to 50, does not ignore
others. Recommendation 5 to 10. If it is too small,
others. Recommendation 5 to 10. If it is too low,
normal bubble areas may be ignored, and if it is too
large, non bubble areas may be considered normal
bubbles
Expand Down
Loading

0 comments on commit 2f61708

Please sign in to comment.