0
stars
649
commits
Python
primary language
Apr 27, 2026
updated
Gradio-based web application for automating the translation of manga/comic page images using AI. Targets speech bubbles and text outside of speech bubbles. Supports 59 target languages and custom font pack usage. The current runtime profile is CUDA-only for local GPU and cloud deployments.
| Original | Translated (w/ a single click) |
|---|---|
![]() | ![]() |
.ttf/.otf files placed under fonts/[!IMPORTANT] This branch is a CUDA-only build. CPU, Apple Metal (
mps), and Intel XPU fallbacks are not supported in the current runtime.
git clone https://github.com/vtp772002/manga_toan.git
cd manga_toan
If you do not want to use Git, download a source archive from GitHub:
Use this path on a CUDA-capable Windows/Linux machine or GPU cloud VM/container.
python -m venv venv
# Windows PowerShell/CMD
.\venv\Scripts\activate
# Linux
source venv/bin/activate
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126
# Example (Windows, Python 3.13, PyTorch 2.10.0, CUDA 13.0)
pip install https://github.com/nunchaku-ai/nunchaku/releases/download/v1.2.1/nunchaku-1.2.1+cu13.0torch2.10-cp313-cp313-win_amd64.whl
pip install -r requirements.txt
If you refresh the repo or replace it with a newer archive, you can usually keep these directories:
fonts/models/output/This repo currently includes packs such as:
fonts/Comic_Neuefonts/font5/VNF-Comic Sansfonts/font5/Font TeddyBearfonts/ with .otf/.ttf filesitalic/bold or both so variants are detectedfonts/
├─ CC Wild Words/
│ ├─ CCWildWords-Regular.otf
│ ├─ CCWildWords-Italic.otf
│ ├─ CCWildWords-Bold.otf
│ └─ CCWildWords-BoldItalic.otf
└─ Komika/
├─ KOMIKA-HAND.ttf
└─ KOMIKA-HANDBOLD.ttf
GOOGLE_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY, XAI_API_KEY, DEEPSEEK_API_KEY, ZAI_API_KEY, MOONSHOT_API_KEY, OPENROUTER_API_KEY, OPENAI_COMPATIBLE_API_KEYhttp://localhost:1234/v1[!NOTE] YanoljaNEXT-Rosetta models (e.g.,
yanolja/YanoljaNEXT-Rosetta-4B-2511-GGUF) are automatically detected when used via the OpenAI-Compatible provider and receive optimized prompting. These are text-only models and require two-step + local OCR model. The Special Instructions field is mapped to Rosetta's translation glossary (one entry per line, e.g.,Yanolja NEXT -> 야놀자넥스트).
If you want to use the OSB text pipeline, you only need a Hugging Face token for gated models:
black-forest-labs/FLUX.1-Kontext-dev (only required if using Flux.1 Kontext with Nunchaku backend)facebook/sam3 (only required if using SAM 3 segmentation)The OSB text detector itself is public and can be preloaded without a Hugging Face token.
hf_token in ConfigHF_TOKEN8000/healthz, /readyzPOST /v1/translateGET /v1/outputs/{filename}Local run:
uvicorn api:app --host 0.0.0.0 --port 8000 --workers 1
Example request:
curl -X POST http://localhost:8000/v1/translate \
-F "image=@/path/to/page.png" \
-F "output_language=Vietnamese" \
-F "provider=OpenAI" \
-F "font_pack=font5/VNF-Comic Sans"
The API auto-detects source language with PaddleOCR-VL. By default it saves the translated image under output/api/ and returns a JSON payload with a download URL.
Run:
python app.py --open-browser
Or bind to all interfaces manually:
python app.py --host 0.0.0.0 --port 7676
Options: --models (default ./models), --fonts (default ./fonts), --port (default 7676).
First launch can take ~1–2 minutes.
Once launched, configure your LLM provider in the Config tab, choose the target language, then upload images and click Translate. Source language is auto-detected locally with PaddleOCR-VL.
Sample images for local testing are available in one_piece/.
docker compose up --buildk8s/pvc.yaml, k8s/secret.example.yaml, k8s/deployment.yaml, then k8s/service.yamlpython app.py --preload-model-assetspython app.py --warmup-models:8000/v1/translate, :8000/healthz, :8000/readyzHF_TOKEN is optional unless you want gated assets such as Flux.1 Kontext or SAM 3models/, fonts/, and output/HF_TOKEN; gated Flux/SAM 3 assets preload when HF_TOKEN is provided/cache/huggingface and /cache/torchExamples:
# Single image, Japanese → English, Google provider
python main.py --input <image_path> \
--font-dir "fonts/Comic_Neue" --provider Google --google-api-key <AI...>
# Quick local smoke test with a bundled sample image
python main.py --input "one_piece/p1.jpg" \
--font-dir "fonts/Comic_Neue" --provider Google --google-api-key <AI...>
# Batch folder, auto-detected source text, custom target language, OpenAI-Compatible provider (LM Studio)
python main.py --input <folder_path> --batch \
--font-dir "fonts/Comic_Neue" \
--output-language <tgt_lang> \
--provider OpenAI-Compatible --openai-compatible-url http://localhost:1234/v1 \
--output ./output
# Single Image, Japanese → English (Google), OSB text pipeline, custom OSB text font
python main.py --input <image_path> \
--font-dir "fonts/Comic_Neue" --provider Google --google-api-key <AI...> \
--osb-enable --osb-font-dir "fonts/font5/VNF-Comic Sans"
# Cleaning-only mode (no translation/text rendering)
python main.py --input <image_path> --cleaning-only
# Upscaling-only mode (no detection/translation, only upscale)
python main.py --input <image_path> --upscaling-only --image-upscale-mode final --image-upscale-factor 2.0
# Test mode (no translation; render placeholder text)
python main.py --input <image_path> --test-mode
# Full options
python main.py --help
From the repo root:
git pull
pip install -r requirements.txt # Or activate venv first if present
If you installed from a ZIP archive instead of Git:
fonts/, models/, and output/ if you want to keep local assetspip install -r requirements.txt
Python
99.3%
0
stars
649
commits
Python
primary language
Apr 27, 2026
updated
Gradio-based web application for automating the translation of manga/comic page images using AI. Targets speech bubbles and text outside of speech bubbles. Supports 59 target languages and custom font pack usage. The current runtime profile is CUDA-only for local GPU and cloud deployments.
| Original | Translated (w/ a single click) |
|---|---|
![]() | ![]() |
.ttf/.otf files placed under fonts/[!IMPORTANT] This branch is a CUDA-only build. CPU, Apple Metal (
mps), and Intel XPU fallbacks are not supported in the current runtime.
git clone https://github.com/vtp772002/manga_toan.git
cd manga_toan
If you do not want to use Git, download a source archive from GitHub:
Use this path on a CUDA-capable Windows/Linux machine or GPU cloud VM/container.
python -m venv venv
# Windows PowerShell/CMD
.\venv\Scripts\activate
# Linux
source venv/bin/activate
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126
# Example (Windows, Python 3.13, PyTorch 2.10.0, CUDA 13.0)
pip install https://github.com/nunchaku-ai/nunchaku/releases/download/v1.2.1/nunchaku-1.2.1+cu13.0torch2.10-cp313-cp313-win_amd64.whl
pip install -r requirements.txt
If you refresh the repo or replace it with a newer archive, you can usually keep these directories:
fonts/models/output/This repo currently includes packs such as:
fonts/Comic_Neuefonts/font5/VNF-Comic Sansfonts/font5/Font TeddyBearfonts/ with .otf/.ttf filesitalic/bold or both so variants are detectedfonts/
├─ CC Wild Words/
│ ├─ CCWildWords-Regular.otf
│ ├─ CCWildWords-Italic.otf
│ ├─ CCWildWords-Bold.otf
│ └─ CCWildWords-BoldItalic.otf
└─ Komika/
├─ KOMIKA-HAND.ttf
└─ KOMIKA-HANDBOLD.ttf
GOOGLE_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY, XAI_API_KEY, DEEPSEEK_API_KEY, ZAI_API_KEY, MOONSHOT_API_KEY, OPENROUTER_API_KEY, OPENAI_COMPATIBLE_API_KEYhttp://localhost:1234/v1[!NOTE] YanoljaNEXT-Rosetta models (e.g.,
yanolja/YanoljaNEXT-Rosetta-4B-2511-GGUF) are automatically detected when used via the OpenAI-Compatible provider and receive optimized prompting. These are text-only models and require two-step + local OCR model. The Special Instructions field is mapped to Rosetta's translation glossary (one entry per line, e.g.,Yanolja NEXT -> 야놀자넥스트).
If you want to use the OSB text pipeline, you only need a Hugging Face token for gated models:
black-forest-labs/FLUX.1-Kontext-dev (only required if using Flux.1 Kontext with Nunchaku backend)facebook/sam3 (only required if using SAM 3 segmentation)The OSB text detector itself is public and can be preloaded without a Hugging Face token.
hf_token in ConfigHF_TOKEN8000/healthz, /readyzPOST /v1/translateGET /v1/outputs/{filename}Local run:
uvicorn api:app --host 0.0.0.0 --port 8000 --workers 1
Example request:
curl -X POST http://localhost:8000/v1/translate \
-F "image=@/path/to/page.png" \
-F "output_language=Vietnamese" \
-F "provider=OpenAI" \
-F "font_pack=font5/VNF-Comic Sans"
The API auto-detects source language with PaddleOCR-VL. By default it saves the translated image under output/api/ and returns a JSON payload with a download URL.
Run:
python app.py --open-browser
Or bind to all interfaces manually:
python app.py --host 0.0.0.0 --port 7676
Options: --models (default ./models), --fonts (default ./fonts), --port (default 7676).
First launch can take ~1–2 minutes.
Once launched, configure your LLM provider in the Config tab, choose the target language, then upload images and click Translate. Source language is auto-detected locally with PaddleOCR-VL.
Sample images for local testing are available in one_piece/.
docker compose up --buildk8s/pvc.yaml, k8s/secret.example.yaml, k8s/deployment.yaml, then k8s/service.yamlpython app.py --preload-model-assetspython app.py --warmup-models:8000/v1/translate, :8000/healthz, :8000/readyzHF_TOKEN is optional unless you want gated assets such as Flux.1 Kontext or SAM 3models/, fonts/, and output/HF_TOKEN; gated Flux/SAM 3 assets preload when HF_TOKEN is provided/cache/huggingface and /cache/torchExamples:
# Single image, Japanese → English, Google provider
python main.py --input <image_path> \
--font-dir "fonts/Comic_Neue" --provider Google --google-api-key <AI...>
# Quick local smoke test with a bundled sample image
python main.py --input "one_piece/p1.jpg" \
--font-dir "fonts/Comic_Neue" --provider Google --google-api-key <AI...>
# Batch folder, auto-detected source text, custom target language, OpenAI-Compatible provider (LM Studio)
python main.py --input <folder_path> --batch \
--font-dir "fonts/Comic_Neue" \
--output-language <tgt_lang> \
--provider OpenAI-Compatible --openai-compatible-url http://localhost:1234/v1 \
--output ./output
# Single Image, Japanese → English (Google), OSB text pipeline, custom OSB text font
python main.py --input <image_path> \
--font-dir "fonts/Comic_Neue" --provider Google --google-api-key <AI...> \
--osb-enable --osb-font-dir "fonts/font5/VNF-Comic Sans"
# Cleaning-only mode (no translation/text rendering)
python main.py --input <image_path> --cleaning-only
# Upscaling-only mode (no detection/translation, only upscale)
python main.py --input <image_path> --upscaling-only --image-upscale-mode final --image-upscale-factor 2.0
# Test mode (no translation; render placeholder text)
python main.py --input <image_path> --test-mode
# Full options
python main.py --help
From the repo root:
git pull
pip install -r requirements.txt # Or activate venv first if present
If you installed from a ZIP archive instead of Git:
fonts/, models/, and output/ if you want to keep local assetspip install -r requirements.txt
Python
99.3%