Skip to main content

Project logo

OCR application for reading manga in Japanese, made for AJATTers🇯🇵

Lancet

PyPi Chat Support

Lancet is an OCR application for reading manga in Japanese. It uses PyTorch models to recognize Japanese text in images. Lancet works best with Goldendict-ng or Rikaitan.

https://github.com/user-attachments/assets/8859adac-1bd8-435a-9c81-945f875dc205

User Guide

Prerequisites:

Launch Goldendict, then open a manga folder in nsxiv. Start Lancet and wait for the OCR model to load. Press the OCR shortcut (default Alt+O) to show the snipping window, then drag and hold the mouse to perform OCR.

Lancet adds an icon to the system tray. Right‑click the icon to access actions, including Preferences, where you can change the OCR shortcut.

Installation

All operating systems

Install via pipx from pypi.

pipx install ajt-lancet

The lancet executable will be available in your $PATH.

[!NOTE] On Windows-like systems, you may need to add the folder containing the lancet executable to your $PATH manually.

[!NOTE] If you don't have the required python version, install it first with hatch.

hatch python install 3.13
pipx install ajt-lancet --python ~/.local/share/hatch/pythons/3.13/python/bin/python

Windows-like operating systems

Download lancet-windows.exe.

GNU/Linux

Download lancet-gnulinux.

System Requirements

Lancet depends on large Python libraries. pipx installs everything in an isolated location (~/.local/share/pipx) so you can cleanly uninstall with pipx uninstall later. The PyTorch models are downloaded from HuggingFace and saved to ~/.cache/huggingface.

  • Disk space: ~8 GiB (PyTorch and dependencies)
  • RAM: at least 2 GiB

Wayland support

Wayland support has been tested on Sway 1.11. Wayland support is incomplete. It works best on Hyprland and Sway, but on other compositors you may face issues if you have multiple monitors. 🙏 Please suggest improvements via pull requests on GitHub.

Upgrading

Running pipx upgrade upgrades lancet to the latest version.

pipx upgrade ajt-lancet

Running pipx upgrade-all upgrades all packages installed with pipx.

pipx upgrade-all

Development Setup

Since Ajatt-Tools is a distributed effort, we highly welcome new contributors! Install the project in development mode to easily test and commit your changes using hatch.

  • Clone the repo.

  • Install hatch:

    pipx install hatch
    pipx upgrade hatch
    
  • CD into the repo and run:

    hatch shell
    
  • Inside the hatch shell run:

    pip install -e .
    
  • To run the app, run:

    hatch run lancet
    

Try these libre code editors with python support:

Autostart

Add the lancet command to your autostart so Lancet launches at login.

Here's an example for i3wm:

exec --no-startup-id lancet

System keyboard shortcuts

On some setups (like Wayland), applications can't register global keyboard shortcuts, so Lancet's shortcuts won't work. You can define shortcuts in your Wayland compositor instead.

Below is an example for Sway. Add the following to your ~/.config/sway/config:

# Run OCR
bindsym $mod+o          exec lancet ocr
# Run OCR with the speech-bubble detector
bindsym $mod+Shift+o    exec lancet ocr --detect
# Take a screenshot
bindsym $mod+Print      exec lancet screenshot

Announcements

  1. Sunsetting Transformers OCR
  2. Meet Lancet

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ajt_lancet-26.8.31.0.tar.gz (7.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ajt_lancet-26.8.31.0-py3-none-any.whl (7.2 MB view details)

Uploaded Python 3

File details

Details for the file ajt_lancet-26.8.31.0.tar.gz.

File metadata

  • Download URL: ajt_lancet-26.8.31.0.tar.gz
  • Upload date:
  • Size: 7.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ajt_lancet-26.8.31.0.tar.gz
Algorithm Hash digest
SHA256 71df45cca3d34ad6e758e49d17016d268281b64de438291d8010c9b6e8528c45
MD5 7446309851a0b0469e532f797b7b9850
BLAKE2b-256 d5a0eea17685fe861cbb3969158f5b739cd0499166851b45b37d8c84e30254d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ajt_lancet-26.8.31.0.tar.gz:

Publisher: release.yml on Ajatt-Tools/lancet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ajt_lancet-26.8.31.0-py3-none-any.whl.

File metadata

  • Download URL: ajt_lancet-26.8.31.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ajt_lancet-26.8.31.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c46eeb9ba8e9a8b5692508e233ba378e8bfe0ae2ab6407f508bd2a848c3242e
MD5 e4d8c7fff56f13e247d4a8759298f179
BLAKE2b-256 253233af7841594498a234d47aa942333ec45fa3d4cfd9e386f732e5d1a02ed6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ajt_lancet-26.8.31.0-py3-none-any.whl:

Publisher: release.yml on Ajatt-Tools/lancet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

26.9.15.0

2 files

This release

26.8.31.0 This release

2 files

26.7.9.0

2 files

26.6.24.0

2 files

26.5.12.0

2 files

26.5.5.0

2 files

26.5.4.0

2 files

26.4.21.0

2 files

26.3.23.0

2 files

26.3.20.0

2 files

26.3.16.0

2 files

26.3.11.0

2 files

26.3.10.0

2 files

26.3.8.2

2 files

26.3.8.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page