demo_gui.mp4
Many Automatic Manga Translators exist. Very few properly support comics of other kinds in other languages. This project was created to utilize the ability of GPT-4 and translate comics from all over the world. Currently, it supports translating to and from English, Korean, Japanese, French, Simplified Chinese, Traditional Chinese, Russian, German, Dutch, Spanish and Italian.
For a couple dozen languages, the best Machine Translator is not Google Translate, Papago or even DeepL, but GPT-4, and by far.
This is very apparent for distant language pairs (Korean<->English, Japanese<->English etc) where other translators still often devolve into gibberish.
Excerpt from "The Walking Practice"(보행 연습) by Dolki Min(돌기민)
GPT-4-Vision as Translator. Note: Some of these also have Official English Translations
Install Python (<=3.10). Tick "Add python.exe to PATH" during the setup.
https://www.python.org/downloads/
Currently, this doesn't work fully on python 3.11 or higher because of issues with PaddleOCR. If you have no intention of translating from Chinese with the Default Option(Paddle), you can use this with 3.11 by replacing
paddleocr==2.7.0.3
paddlepaddle==2.5.2
with
PyMuPDF==1.23.8
in the requirements.txt file.
Clone the repo (or download the folder), navigate to the folder
git clone https://github.com/ogkalu2/comic-translate
cd comic-translate
and install the requirements
pip install -r requirements.txt
If you have an NVIDIA GPU, then it is recommended to run
pip uninstall torch torchvision
pip install torch==2.1.0+cu121 -f https://download.pytorch.org/whl/torch_stable.html
pip install torchvision==0.16.0+cu121 -f https://download.pytorch.org/whl/torch_stable.html
Note: The 121 in +cu121 represents the CUDA version - 12.1. Replace 121 with your CUDA version. E.g 118 if you are running CUDA 11.8
In the comic-translate directory, run
python comic.py
This will launch the GUI
- Import > Images to select a Single or multiple Images. If you have a CBR file, you'll need to install Winrar or 7-Zip then add the folder it's installed to (e.g "C:\Program Files\WinRAR" for Windows) to Path. If it's installed but not to Path, you may get the error,
raise RarCannotExec("Cannot find working tool")
In that case, Instructions for Windows, Linux, Mac
- Go to Settings > Text Rendering > Adjust Textblocks to adjust the dimensions of the blocks used for rendering. For situations where text is rendered too big/small. It will apply to all detcted blocks on the page
- Make sure the selected Font supports characters of the target language
To following selections will require access to closed resources and subsequently, API Keys:
- GPT-4-Vision, 4 or 3.5 for Translation (Paid, about $0.02 USD/Page for 4-Turbo)
- DeepL Translator (Free for 500,000 characters/month)
- GPT-4-Vision for OCR (Default Option for French, Russian, German, Dutch, Spanish, Italian) (Paid, about $0.04 USD/Page)
- Microsoft Azure Vision for OCR (Free for 5000 images/month)
- Google Cloud Vision for OCR (Free for 1000 images/month). You can set your API Keys by going to Settings > Set Credentials
- Go to OpenAI's Platform website at platform.openai.com and sign in with (or create) an OpenAI account.
- Hover your Mouse over the right taskbar of the page and select "API Keys."
- Click "Create New Secret Key" to generate a new API key. Copy and store it.
- Sign in/Create a Google Cloud account. Go to Cloud Resource Manager and click "Create Project". Set your project name.
- Select your project here then select "Billing" then "Create Account". In the pop-up, "Enable billing account", and accept the offer of a free trial account. Your "Account type" should be individual. Fill in a valid credit card.
- Enable Google Cloud Vison for your project here
- In the Google Cloud Credentials page, click "Create Credentials" then API Key. Copy and store it.
speech-bubble-detector, text-segmenter. Two yolov8m models trained on 8k and 3k images of comics (Manga, Webtoons, Western) respectively.
By Default:
- EasyOCR for English
- manga-ocr for Japanese
- Pororo for Korean
- PaddleOCR for Chinese
- GPT-4-Vision for French, Russian, German, Dutch, Spanish and Italian. Paid, Requires an API Key.
Optional:
These can be used for any of the supported languages. An API Key is required.
A Manga/Anime finetuned lama checkpoint to remove text detected by the segmenter. Implementation courtsey of lama-cleaner
Currently, this supports using GPT-4-Vision, GPT-4, GPT-3.5, DeepL and Google Translate. All GPT models are fed the context of the entire page text to aid translations. GPT-4-Vision specifically is also provided the image of the page, the page with the original text for languages it is competent at recognizing (French, Russian, German, Dutch, Spanish, Italian) and the Inpainted Image for the rest.
PIL for rendering wrapped text in bounding boxes obtained from bubbles and text.
- https://github.com/hoffstadt/DearPyGui
- https://github.com/ultralytics/ultralytics
- https://github.com/Sanster/lama-cleaner
- https://huggingface.co/dreMaz
- https://github.com/yunwoong7/korean_ocr_using_pororo
- https://github.com/kha-white/manga-ocr
- https://github.com/JaidedAI/EasyOCR
- https://github.com/PaddlePaddle/PaddleOCR