8000 feat(documents): keep anytopdf's face and object plugins and ask them about a picture by adeelahmad · Pull Request #221 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content 8000

feat(documents): keep anytopdf's face and object plugins and ask them about a picture - #221

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-j5in0x
Oct 7, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-j5in0x

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Description

Before: Lens kept only the anytopdf program and always ran it with --no-plugins, so it couldn't use anytopdf's face or object detection.

After: when Lens fetches anytopdf 0.4.0, it keeps the faces, face-id and objects plugins beside the program. A new anytopdf.analyze(cfg, picture, models) returns what those plugins find in one picture as Lens-shaped results: {"kind": "face" | "object", "label", "box": [x, y, w, h] fractions, "score", "attributes"}. Nothing calls it yet. Each later feature (objects, faces) uses it in its own PR.

How:

  • Sandboxed: analyze runs anytopdf --no-config --plugin-sandbox strict convert … --dump-graph in a temp directory, with no network (netguard.nowhere_env).
  • Environment: every ANYTOPDF_* variable is stripped except the models Lens names, such as ANYTOPDF_OBJECTS_MODEL.
  • Reads: the sandbox may read only the picture and those model files.
  • Old fetches: a copy fetched before plugins were kept is fetched again.

Motivation and Context

This is the base for the next anytopdf integration steps. Tested against the real v0.4.0 release, analyze on the bus photo with Lens's yolox_s.onnx returns 1 bus and 4 people with their boxes, matching Lens's own YOLOX.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (ruff, ruff format and mypy pass locally).
  • I added or updated tests:
    • test_its_plugins_look_at_a_picture checks the fake's results, the sandbox flags and the stripped environment.
    • The fetch test now checks that only the program and Lens's plugins are kept, and that an old fetch is redone.
    • The real-binary test also runs analyze. It passed against v0.4.0.
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/configuration.md#anytopdf).
  • No CHANGELOG entry: nothing user-facing changes until a feature uses it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HysPx1nJnWBK2JJKbmbqdZ


Generated by Claude Code

… about a picture

The base the per-feature threads build on: anytopdf.fetch keeps the
faces, face-id and objects plugins beside the program, and
anytopdf.analyze runs them, strict-sandboxed with no network, on one
picture and returns Lens-shaped faces and objects.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HysPx1nJnWBK2JJKbmbqdZ
@adeelahmad
adeelahmad merged commit bf40f9b into main Oct 7, 2026
7 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-j5in0x branch October 7, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0