lbl/redaction
0
1---2title: Redac3emoji: ๐ก๏ธ4colorFrom: blue5colorTo: gray6sdk: docker7pinned: false8license: mit9tags:10 - security11 - privacy12 - nlp13 - pii-redaction14 - privacy-protection15 - french-nlp16---17 18# ๐ก๏ธ Redac19 20A lightweight PII (Personally Identifiable Information) moderation MVP designed to sanitize sensitive data before it reaches LLM APIs.21 22---23 24## ๐ฅ Demo25 26Check out Redac in action:27 28<div align="center">29 <a href="https://www.youtube.com/shorts/OkwsoL4H5cc">30 <img src="https://img.youtube.com/vi/OkwsoL4H5cc/maxresdefault.jpg" alt="Redac Demo Video" width="600" style="border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);">31 </a>32 <p><i>Click to watch the full demo on YouTube</i></p>33</div>34 35---36 37## ๐ API Documentation38 39The Redac API is open and can be integrated into your own workflows.40 41### ๐ Base URL42`https://lbl-redaction.hf.space/api`43 44### โก Rate Limiting45- **1 request every 2 seconds** per IP address to ensure stability.46- Exceeding this limit will return a `429 Too Many Requests` status code with a helpful message.47 48### ๐ Endpoints49 50#### 1. Redact Text51Processes a text and returns the anonymized version along with metadata about detected entities.52 53- **URL**: `/redact`54- **Method**: `POST`55- **Headers**: `Content-Type: application/json`56- **Body**:57 ```json58 {59 "text": "Your sensitive text here",60 "language": "auto" 61 }62 ```63 *(Options for language: `auto`, `en`, `fr`)*64 65- **Success Response (200 OK)**:66 ```json67 {68 "original_text": "...",69 "redacted_text": "My name is <PERSON>",70 "detected_language": "en",71 "entities": [72 {73 "type": "PERSON",74 "text": "John Doe",75 "score": 95,76 "start": 11,77 "end": 1978 }79 ]80 }81 ```82 83#### 2. System Status84Checks if the API and NLP engines are online.85 86- **URL**: `/status`87- **Method**: `GET`88 89---90 91## ๐ Key Features92 93- **Multi-Language Support**: High-accuracy detection for **English** and **French** using `spaCy` Large models.94- **Double-Pass Protection**: Combines NLP-based detection with expert Regex patterns for PII coverage.95- **Expert French Recognizers**: Built-in support for French-specific data: **SIRET**, **NIR**, **IBAN**, and addresses.96- **Balanced Anonymization**: Preserves job titles and document structure to keep texts readable.97- **Minimal Dashboard**: React-based UI with Risk Assessment visualization.98 99---100 101## ๐ ๏ธ Architecture102 1031. **Core API (`/api`)**: FastAPI server powered by **Microsoft Presidio**.1042. **Web Dashboard (`/ui`)**: React + Vite + Tailwind CSS.105 106---107 108## ๐ฆ Local Development109 110### Manual Docker commands111```bash112docker compose up --build113```114 115- **API**: `http://localhost:8000/api`116- **UI Dashboard**: `http://localhost:5173`117 118---119 120## ๐ License121MIT - Created for secure LLM workflows.122 