João Pedro Battistella Nadas a63b11e467 feat(ocr): live camera viewfinder + invert-colours toggle
Four wins:

1. Replace <input type=file capture> with a getUserMedia
   viewfinder modal on mobile. Tapping the shutter goes straight
   to the crop modal — skips the OS "retake/use" confirm step.
   Falls back to file picker if camera permission is denied or
   the API is unavailable. "Pick from file" icon
   (photo_library) inside the camera modal opens the gallery
   on demand.

2. Drop the Reset button — with no default crop box, "reset" is
   just "no box again," which is the starting state anyway.

3. The check (Use this) button is now larger and more prominent
   — wider padding, 24px icon, accent fill.

4. Invert-colours toggle (invert_colors icon) in the crop modal.
   White-on-dark text (signs, menus, screenshots) breaks
   Tesseract because the binariser was made for ink on paper.
   Toggling the button flips the grayscale buffer before
   adaptive thresholding so the binary output ends up
   black-on-white. State plumbed cleanly: openCropper now
   resolves with {blob, invert}; preprocessForOCR takes an
   {invert} option; binarizeAdaptive applies the flip.

Also: drop `capture=environment` from the file <input>. Without
it the file path correctly opens the gallery/file dialog instead
of re-opening the OS camera when the user picks "Pick from file".
2026-06-09 19:27:34 +02:00
2026-06-09 17:22:26 +02:00

finrod

Tiny web translator backed by Ollama on radagast. Named for Finrod Felagund, Noldor loremaster of the tongues of Men.

Run

uv run uvicorn app:app --host 127.0.0.1 --port 8000 --reload

Then open http://127.0.0.1:8000.

Config

Env var Default Notes
OLLAMA_URL http://radagast.jpnadas.xyz:11434 Ollama base URL
MODEL_FILTER gemma,aya Comma-separated substrings; model matches if it contains any. Empty = show all

Models

For Pt/Nl/En translation, three worth A/B-ing:

ssh radagast 'ollama pull gemma2:9b'      # already there — big-and-broad baseline
ssh radagast 'ollama pull gemma3:4b'      # newer multilingual training, ~2-3× faster on Ivy Bridge
ssh radagast 'ollama pull aya-expanse:8b' # Cohere multilingual model, strong on Dutch

All three fit in radagast's 10 GB at Q4. Switching models in the dropdown forces Ollama to load the new weights — expect a 5-15 s pause on the first call after a switch while it reads from disk.

Build / push image

Built locally and pushed to Scaleway — no Gitea runners on the homelab yet, so there's no CI workflow.

One-time setup (host needs buildx + QEMU for cross-arch):

docker buildx create --name multi --use
docker run --privileged --rm tonistiigi/binfmt --install all
docker login rg.nl-ams.scw.cloud -u nologin -p <SCW_SECRET_KEY>

Then on every change:

./build.sh

That builds linux/amd64,linux/arm64 and pushes three tags:

  • :latest — moving pointer
  • :<git-short-sha> — immutable, traceable
  • :<pyproject-version> (e.g. :0.1.0) — semver

Deploy

Cluster manifests live in valinor/apps/finrod/ (bjw-s app-template, internal-only ingress at finrod.jpnadas.xyz). To roll out a new build, bump tag: in valinor/apps/finrod/values.yaml to the new semver on a branch → PR → merge → ArgoCD syncs.

Release workflow

This project uses Semantic Versioning and keeps a human-edited CHANGELOG.md.

To cut a release:

  1. On a branch, edit CHANGELOG.md: move accumulated [Unreleased] notes into a new ## [X.Y.Z] - YYYY-MM-DD section.
  2. Bump version in pyproject.toml to X.Y.Z.
  3. PR → merge to main.
  4. Tag the merge commit:
    git checkout main && git pull
    git tag -a vX.Y.Z -m "vX.Y.Z"
    git push origin vX.Y.Z
    
  5. ./build.sh — the image now also gets :X.Y.Z (read from pyproject.toml).
  6. In valinor, bump apps/finrod/values.yaml tag: from the previous version to X.Y.Z on a branch → PR → ArgoCD picks it up.
Description
No description provided
Readme 483 KiB
Languages
HTML 82.1%
JavaScript 7.2%
Python 6.3%
Dockerfile 2.4%
Shell 2%