Add Space metadata tags and a visible README badge section for Redac's Build Small Hackathon track, sponsor, and achievement claims.
Co-authored-by: OpenAI Codex <codex@openai.com>
feat: frame output for copy-to-LLM use with one-click copy button
Clarify the core flow: extract locally, copy the redacted output, paste into
any LLM with no raw PII exposed.
- app.py: add a one-click copy button on the safe output (version-safe via
_COPY, since show_copy_button exists in Gradio 5.x but not 6.x); relabel
outputs ("Safe output — copy into your LLM" / "Extracted fields — stays
local, never sent"); reword the header to describe the copy-to-LLM flow.
Co-authored-by: OpenAI Codex <codex@openai.com>
fix: pin Gradio 5.44.1 to resolve transformers/hub dependency conflict
MiniCPM-V-4.6 has model_type 'minicpmv4_6' and requires transformers>=5.7.0,
which the Space's transformers 4.x can't load (ValueError: architecture not
recognized). Switch to MiniCPM-V-4.5 (model_type 'minicpmv'), which uses
trust_remote_code + model.chat() on transformers 4.x.
- redac/vision.py: MODEL_ID -> openbmb/MiniCPM-V-4_5; load/download weights
on CPU before entering the @spaces.GPU window so the 16GB download can't
exhaust the ZeroGPU time budget; deterministic decoding (sampling=False).
- requirements.txt: pin transformers>=4.49,<5; add timm.
- app.py: make local port configurable via GRADIO_SERVER_PORT (xray-anything
occupies 7860-7863).
Co-authored-by: OpenAI Codex <codex@openai.com>
fix: graceful regex-only fallback when GLiNER unavailable
Prevent a hard crash (ModuleNotFoundError: gliner) when GLiNER isn't
installed locally, and reduce regex false positives.
- redac/detect.py: add gliner_available(); skip the GLiNER path and run
regex-only when it can't be imported. Phone recognizer now ignores dates
and digit runs shorter than 7 digits (serial numbers).
- app.py: show a warning banner when running in regex-only mode.
On the Space, GLiNER is installed so full NER runs; locally the app no
longer errors.
Co-authored-by: OpenAI Codex <codex@openai.com>
feat: image extraction via in-Space vision model (MiniCPM-V-4.6)
Add image -> text extraction so users can drop in a document or ID image and
have the fields extracted, then redacted by the existing core.
- redac/vision.py: extract_text_from_image() loads MiniCPM-V-4.6 via
transformers and runs under @spaces.GPU (ZeroGPU). REDAC_MOCK=1 returns a
canned extraction for GPU-less local UI testing.
- app.py: split into Text and Image tabs sharing one redaction core; image
flow shows raw extracted fields, redacted output, entity table, rehydrate.
- redac/detect.py: phone recognizer no longer matches ISO/common dates.
- requirements.txt: transformers, torchvision, accelerate, sentencepiece,
pillow, spaces.
Co-authored-by: OpenAI Codex <codex@openai.com>
feat: V1 text PII detection and reversible redaction
OpenAI Codex
45a3a86
Add the local redaction core and Gradio UI for Redac V1 (text).
- redac/detect.py: PII detection combining GLiNER (PII-tuned zero-shot NER)
with deterministic regex recognizers (email, phone, IBAN, credit card,
IP, national ID), with overlap resolution favoring specific recognizers.
- redac/redact.py: reversible redaction with stable per-value placeholders
and local rehydrate() to restore originals.
- app.py: Gradio interface (text in, redacted out, entity table, adjustable
labels/threshold, local rehydrate panel).
- requirements.txt, .gitignore.