Metadata-Version: 2.5
Name: acromeld
Version: 0.1.0
Summary: Turn a flat PDF into a fillable AcroForm document
Project-URL: Homepage, https://github.com/Samyssmile/acromeld
Project-URL: Model, https://huggingface.co/Cadmon/AcroMELD
Author: Samuel Abramov
License-Expression: Apache-2.0
License-File: LICENSE
License-File: THIRD-PARTY-NOTICES.md
Keywords: acroform,document-ai,form-fields,object-detection,pdf
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Text Processing :: General
Requires-Python: >=3.11
Requires-Dist: huggingface-hub>=0.24
Requires-Dist: numpy>=1.26
Requires-Dist: pillow>=10.0
Requires-Dist: pymupdf>=1.24
Requires-Dist: pypdfium2>=4.30
Requires-Dist: pyyaml>=6.0
Requires-Dist: torch>=2.2
Requires-Dist: torchvision>=0.17
Description-Content-Type: text/markdown

# AcroMELD

**Turns a flat PDF into a fillable form.** Give it a PDF that looks like a form but has no
form fields, and it finds every field and writes a real, clickable AcroForm.

```sh
acromeld input.pdf output.pdf
```

The first run downloads the model (158 MB) from Hugging Face and caches it. CPU is the
default and works fine; a page takes a few seconds.

From Python:

```py
from acromeld import prepare_form

prepare_form("input.pdf", "output.pdf")
```

## Options

| Argument | Default | Description |
|---|---|---|
| `--weights` | download | use a local weights file instead of the Hub |
| `--device` | `cpu` | torch device, e.g. `cuda` |
| `--confidence TEXT CHOICE SIGNATURE` | calibrated | override the per-class thresholds |
| `--keep-existing-fields` | off | keep form fields the PDF already has |
| `--use-signature-fields` | off | write real signature widgets |
| `--multiline` | off | allow multiline input in text fields |

## What it detects

Three field types — **Text**, **Choice**, **Signature** — plus a learned link that merges
several visual candidates into one field instead of emitting duplicates. It reads two
channels at once: the rendered page, and the PDF's own drawing primitives, which a purely
visual detector ignores. 39.4M parameters, up to 896 fields per page.

## How well it works

Measured once on a sealed holdout of 1,996 PDFs / 6,843 pages the model never saw during
training, against a threshold registered before training started: containment micro-F1
**0.84767** against a required **0.82904** — passed.

**Read this before using it:**

- **Signature detection does not work.** At the calibrated threshold the model predicts
  essentially no signature fields. Text and Choice carry the entire score.
- Under a stricter IoU/COCO adapter the same model reaches only `0.28996` mAP, below a
  locally evaluated CommonForms-L reference.
- Measured on **German-language forms**. Other languages and layouts are untested.
- Rotated pages are rejected rather than silently misplaced.
- One sealed run, one seed. No stability claim.

This is a research artifact, not a product.

## Licence

Apache-2.0. Vendored third-party components and their modifications are listed in
`THIRD-PARTY-NOTICES.md` in the source distribution.
