File size: 2,276 Bytes
849cb09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: Agentic Document Redaction
emoji: πŸ€–
colorFrom: blue
colorTo: yellow
sdk: docker
app_file: agent-redact/shared/gradio_app.py
pinned: false
license: agpl-3.0
short_description: Agentic interface to redact PDF documents
---

# Pi agent β€” agentic document redaction

Orchestrate document redaction with **[Pi](https://github.com/earendil-works/pi)** and **Google Gemini**. Heavy redaction runs on a separate **private [doc_redaction](https://huggingface.co/spaces/seanpedrickcase/document_redaction)** Hugging Face Space (simple text extraction + Local PII).

## Before you start

1. **Gemini API key** β€” paste in **Agent backend** β†’ **Apply backend** (session-only; not stored on disk).
2. **HF token** β€” Space admin should set `HF_TOKEN` under **Settings β†’ Secrets** so this Space can call the private redaction backend. Users may optionally override per session in the UI.

## Limitations

- **No face or signature VLM** β€” text-layer PII only via Local spaCy/Presidio on the remote Space.
- **No Pass 2 VLM** on this deployment.
- **Ephemeral storage** β€” download deliverables from **Workspace output files** before the Space restarts.
- **Human review** β€” outputs are not guaranteed complete; review redacted PDFs before release.

## Defaults

| Setting | Value |
|---------|--------|
| Pi LLM | Gemini (`gemini-flash-latest` default) |
| Redaction backend | `https://seanpedrickcase-document-redaction.hf.space` |
| Text extraction | `Local model - selectable text` |
| PII detection | `Local` |

## Examples

Two sample PDFs load in **Redaction task** β†’ **Try an example** (same demos as the main doc_redaction app). Examples are **on by default**; set Space variable `AGENT_GRADIO_SHOW_EXAMPLES=false` to hide them. (`SHOW_PI_EXAMPLES` is also accepted.)

If examples do not appear, the UI shows a short status message (usually missing PDFs in the image β€” rebuild after a successful sync with LFS materialization).

## Development

This Space is synced from the [doc_redaction monorepo](https://github.com/seanpedrick-case/doc_redaction) on pushes to **`dev`** (see `.github/workflows/sync-pi-agent-space.yml`). Space: [seanpedrickcase/agentic_document_redaction](https://huggingface.co/spaces/seanpedrickcase/agentic_document_redaction).