Spaces:
Sleeping
Sleeping
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: pdfFormDetector
|
| 3 |
+
emoji: 📄
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 6.13.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# CommonForms — Form Field Detector
|
| 14 |
+
|
| 15 |
+
Gradio Space que usa o modelo **FFDNet-L** (`jbarrow/FFDNet-L-cpu`) via o
|
| 16 |
+
pacote oficial [`commonforms`](<https://pypi.org/project/commonforms/>) para
|
| 17 |
+
converter PDFs em formulários preenchíveis, detectando:
|
| 18 |
+
|
| 19 |
+
- text boxes
|
| 20 |
+
- checkboxes (choice buttons)
|
| 21 |
+
- signature fields (opcional)
|
| 22 |
+
|
| 23 |
+
Paper: [CommonForms — arxiv 2509.16506](<https://arxiv.org/abs/2509.16506>)
|
| 24 |
+
|
| 25 |
+
## Arquivos
|
| 26 |
+
|
| 27 |
+
| Arquivo | Propósito |
|
| 28 |
+
|-------------------|----------------------------------------------------------------|
|
| 29 |
+
| `app.py` | UI Gradio + endpoint `/detect` |
|
| 30 |
+
| `requirements.txt`| `gradio==6.13.0` + `commonforms` |
|
| 31 |
+
| `packages.txt` | `poppler-utils` (necessário pra `pdf2image`) |
|
| 32 |
+
| `README.md` | Metadata do Space + docs |
|
| 33 |
+
|
| 34 |
+
O pacote `commonforms` baixa o ONNX do FFDNet-L do HF Hub no primeiro uso.
|
| 35 |
+
|
| 36 |
+
## Endpoint
|
| 37 |
+
|
| 38 |
+
```python
|
| 39 |
+
from gradio_client import Client, handle_file
|
| 40 |
+
|
| 41 |
+
client = Client("luisabwk/pdfFormDetector")
|
| 42 |
+
out_pdf = client.predict(
|
| 43 |
+
pdf_path=handle_file("/caminho/input.pdf"),
|
| 44 |
+
image_size=1600,
|
| 45 |
+
use_signature_fields=False,
|
| 46 |
+
keep_existing_fields=False,
|
| 47 |
+
api_name="/detect",
|
| 48 |
+
)
|
| 49 |
+
print(out_pdf) # path para o PDF preenchível
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## Parâmetros
|
| 53 |
+
|
| 54 |
+
- **image_size** (512–2048, default 1600) — maior = mais preciso, mais lento.
|
| 55 |
+
- **use_signature_fields** — detecta regiões de assinatura.
|
| 56 |
+
- **keep_existing_fields** — preserva widgets AcroForm já presentes.
|