phantom-ship: add tesseract to bon service for OCR
This commit is contained in:
parent
4525e73f1a
commit
647d748d30
1 changed files with 9 additions and 2 deletions
|
|
@ -394,9 +394,10 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# bon — receipt scanner Mini App (camera capture + gallery).
|
# bon — receipt scanner Mini App (camera capture + gallery + OCR).
|
||||||
# Code rsync'd from ~/python-projects/26_bon/ to /home/danny/bon/
|
# Code rsync'd from ~/python-projects/26_bon/ to /home/danny/bon/
|
||||||
# Images on disk under /home/danny/.local/share/bon/images/<user_id>/
|
# Images on disk under /home/danny/.local/share/bon/images/<user_id>/
|
||||||
|
# OCR via tesseract (binary on PATH; server uses subprocess directly).
|
||||||
systemd.services.bon = let
|
systemd.services.bon = let
|
||||||
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
||||||
fastapi
|
fastapi
|
||||||
|
|
@ -405,12 +406,18 @@ in
|
||||||
python-multipart
|
python-multipart
|
||||||
pillow
|
pillow
|
||||||
]);
|
]);
|
||||||
|
# English-only for now — Danish receipts in DK are mostly English chars
|
||||||
|
# plus prices, which `eng` handles fine. Add more languages later if
|
||||||
|
# vyscul or other testers report missed text.
|
||||||
|
tesseractEng = pkgs.tesseract.override {
|
||||||
|
enableLanguages = [ "eng" ];
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
description = "bon FastAPI server (receipt scanner)";
|
description = "bon FastAPI server (receipt scanner)";
|
||||||
after = [ "network-online.target" ];
|
after = [ "network-online.target" ];
|
||||||
wants = [ "network-online.target" ];
|
wants = [ "network-online.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
path = [ pythonEnv ];
|
path = [ pythonEnv tesseractEng ];
|
||||||
environment = {
|
environment = {
|
||||||
SHIPYARD_BOT_TOKEN_FILE = "/home/danny/.secrets/telegram-bot-token-shipyard";
|
SHIPYARD_BOT_TOKEN_FILE = "/home/danny/.secrets/telegram-bot-token-shipyard";
|
||||||
BON_DB_PATH = "/home/danny/.local/share/bon/bon.db";
|
BON_DB_PATH = "/home/danny/.local/share/bon/bon.db";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue