Panel-first comic/manga/webtoon reader: detects panels, reads text with RT-DETR-v2 + PP-OCRv5, summarizes with a local LLM or the OpenCode CLI, and builds a multilingual HTML gallery of the panels that match the summary.
Python
0
2 commits
updated Oct 17, 2026
A panel-first reader for comics, manga and webtoons. It finds the panels in every page, reads the text inside each panel, summarizes the chapter with an LLM, and builds an HTML gallery with the panels that match the summary.
Everything in the codebase (identifiers, comments, docstrings, CLI help, terminal messages and prompts) is written in English. Only the AI reply and the generated HTML page follow the language chosen at runtime.
mangas/ or webtoons/) and
finds every chapter folder automatically, at any depth
(e.g. mangas/one-piece/1).←/→
to navigate, Esc to close) and clickable images in full screen.pt-br, english, korean, japanese, chinese
(default: english) — drives both the AI reply and the HTML UI.local — llama-cpp-python
with a GGUF model (default: Qwen/Qwen3-4B-GGUF, Q4_K_M);opencode — the OpenCode CLI (opencode run),
with cost/token reporting per session.llama-cpp-python was built with CUDA, the LLM too).chapter folder ──► panel detection ──► text detection (RT-DETR-v2)
│ │
│ ▼
│ OCR (PP-OCRv5, per panel)
│ │
▼ ▼
annotated images + cropped panels ────► chapter texts
│
┌───────────────────┴───────────────────┐
▼ ▼
1st LLM call: summary 2nd LLM call: panels that match
│ │
└───────────────┬───────────────────────┘
▼
summary.html + summary.txt (+ browser)
The output is written next to the chapter folder, with the -ai suffix
(e.g. mangas/one-piece/1 → mangas/one-piece/1-ai), containing:
panels/ with the cropped panel images;_chapter_texts.txt with the extracted texts;summary.txt and summary.html.ai-comic-reader/
├── main.py # the whole application (single file)
├── requirements.txt # core dependencies
├── LICENSE # MIT license
├── .pylintrc # pylint configuration
├── .gitignore
├── mangas/ # manga chapters — git-ignored
└── webtoons/ # webtoon chapters — git-ignored
requirements.txt): torch,
transformers, ultralytics, onnxruntime, opencv-python, pillow,
numpy, huggingface_hubllama-cpp-pythonopencode binary on PATHonnxruntime-gpu instead of
onnxruntime and a CUDA build of PyTorch# clone the repository
git clone [email protected]:Uemerson/ai-comic-reader.git
cd ai-comic-reader
# core dependencies
pip install -r requirements.txt
# optional: local GGUF LLM backend
pip install llama-cpp-python
# optional: OpenCode backend — have the `opencode` binary on your PATH
The detection/OCR models are downloaded automatically from Hugging Face on
the first run and cached under ~/.cache/comic_ocr (override with the
COMIC_OCR_MODELS_DIR environment variable).
# scan mangas/ (whole tree), summarize and open the result
python main.py
# scan webtoons/ instead
python main.py --kind webtoon
# AI reply + HTML in Brazilian Portuguese
python main.py --language pt-br
# summarize through the OpenCode CLI
python main.py --llm opencode \
--opencode-model opencode-go/deepseek-v4.1-flash
# local GGUF backend
python main.py --llm local --model Qwen/Qwen3-8B-GGUF
# force the GPU / limit the images
python main.py --device cuda
python main.py --max 0
| Option | Default | Description |
|---|---|---|
--kind {manga,webtoon} | manga | reading kind; defines which folder is scanned (manga → mangas/, webtoon → webtoons/) |
--language {pt-br,english,korean,japanese,chinese} | english | language of the AI reply and of the generated HTML page |
--llm {local,opencode} | local | LLM backend |
--model | Qwen/Qwen3-4B-GGUF | GGUF repo on Hugging Face (local backend) |
--model-file | (auto) | specific .gguf file (local backend) |
--opencode-model | opencode-go/deepseek-v4.1-flash | OpenCode model (provider/model[#variant]) |
--opencode-bin | opencode | OpenCode binary |
--opencode-agent | (none) | OpenCode agent |
--device | (auto) | cpu or cuda; otherwise detected automatically |
--pad | 8 | panel padding in pixels |
--max | 0 | 0 = every image; otherwise at most N |
opencode backend, the cost and token usage of the session are
printed in the terminal, saved in summary.txt and shown in the HTML
footer.This project is licensed under the MIT License — see the LICENSE file for details.
Panel-first comic/manga/webtoon reader: detects panels, reads text with RT-DETR-v2 + PP-OCRv5, summarizes with a local LLM or the OpenCode CLI, and builds a multilingual HTML gallery of the panels that match the summary.
Python
0
2 commits
updated Oct 17, 2026
A panel-first reader for comics, manga and webtoons. It finds the panels in every page, reads the text inside each panel, summarizes the chapter with an LLM, and builds an HTML gallery with the panels that match the summary.
Everything in the codebase (identifiers, comments, docstrings, CLI help, terminal messages and prompts) is written in English. Only the AI reply and the generated HTML page follow the language chosen at runtime.
mangas/ or webtoons/) and
finds every chapter folder automatically, at any depth
(e.g. mangas/one-piece/1).←/→
to navigate, Esc to close) and clickable images in full screen.pt-br, english, korean, japanese, chinese
(default: english) — drives both the AI reply and the HTML UI.local — llama-cpp-python
with a GGUF model (default: Qwen/Qwen3-4B-GGUF, Q4_K_M);opencode — the OpenCode CLI (opencode run),
with cost/token reporting per session.llama-cpp-python was built with CUDA, the LLM too).chapter folder ──► panel detection ──► text detection (RT-DETR-v2)
│ │
│ ▼
│ OCR (PP-OCRv5, per panel)
│ │
▼ ▼
annotated images + cropped panels ────► chapter texts
│
┌───────────────────┴───────────────────┐
▼ ▼
1st LLM call: summary 2nd LLM call: panels that match
│ │
└───────────────┬───────────────────────┘
▼
summary.html + summary.txt (+ browser)
The output is written next to the chapter folder, with the -ai suffix
(e.g. mangas/one-piece/1 → mangas/one-piece/1-ai), containing:
panels/ with the cropped panel images;_chapter_texts.txt with the extracted texts;summary.txt and summary.html.ai-comic-reader/
├── main.py # the whole application (single file)
├── requirements.txt # core dependencies
├── LICENSE # MIT license
├── .pylintrc # pylint configuration
├── .gitignore
├── mangas/ # manga chapters — git-ignored
└── webtoons/ # webtoon chapters — git-ignored
requirements.txt): torch,
transformers, ultralytics, onnxruntime, opencv-python, pillow,
numpy, huggingface_hubllama-cpp-pythonopencode binary on PATHonnxruntime-gpu instead of
onnxruntime and a CUDA build of PyTorch# clone the repository
git clone [email protected]:Uemerson/ai-comic-reader.git
cd ai-comic-reader
# core dependencies
pip install -r requirements.txt
# optional: local GGUF LLM backend
pip install llama-cpp-python
# optional: OpenCode backend — have the `opencode` binary on your PATH
The detection/OCR models are downloaded automatically from Hugging Face on
the first run and cached under ~/.cache/comic_ocr (override with the
COMIC_OCR_MODELS_DIR environment variable).
# scan mangas/ (whole tree), summarize and open the result
python main.py
# scan webtoons/ instead
python main.py --kind webtoon
# AI reply + HTML in Brazilian Portuguese
python main.py --language pt-br
# summarize through the OpenCode CLI
python main.py --llm opencode \
--opencode-model opencode-go/deepseek-v4.1-flash
# local GGUF backend
python main.py --llm local --model Qwen/Qwen3-8B-GGUF
# force the GPU / limit the images
python main.py --device cuda
python main.py --max 0
| Option | Default | Description |
|---|---|---|
--kind {manga,webtoon} | manga | reading kind; defines which folder is scanned (manga → mangas/, webtoon → webtoons/) |
--language {pt-br,english,korean,japanese,chinese} | english | language of the AI reply and of the generated HTML page |
--llm {local,opencode} | local | LLM backend |
--model | Qwen/Qwen3-4B-GGUF | GGUF repo on Hugging Face (local backend) |
--model-file | (auto) | specific .gguf file (local backend) |
--opencode-model | opencode-go/deepseek-v4.1-flash | OpenCode model (provider/model[#variant]) |
--opencode-bin | opencode | OpenCode binary |
--opencode-agent | (none) | OpenCode agent |
--device | (auto) | cpu or cuda; otherwise detected automatically |
--pad | 8 | panel padding in pixels |
--max | 0 | 0 = every image; otherwise at most N |
opencode backend, the cost and token usage of the session are
printed in the terminal, saved in summary.txt and shown in the HTML
footer.This project is licensed under the MIT License — see the LICENSE file for details.