CoolFace
Apppublic

lbl/redaction

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes
App README

๐Ÿ›ก๏ธ Redac

A lightweight PII (Personally Identifiable Information) moderation MVP designed to sanitize sensitive data before it reaches LLM APIs.


๐ŸŽฅ Demo

Check out Redac in action:

<div align="center"> <a href="https://www.youtube.com/shorts/OkwsoL4H5cc"> <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);"> </a> <p><i>Click to watch the full demo on YouTube</i></p> </div>


๐Ÿ“– API Documentation

The Redac API is open and can be integrated into your own workflows.

๐Ÿ  Base URL

https://lbl-redaction.hf.space/api

โšก Rate Limiting

  • โ€”1 request every 2 seconds per IP address to ensure stability.
  • โ€”Exceeding this limit will return a 429 Too Many Requests status code with a helpful message.

๐Ÿ” Endpoints

1. Redact Text

Processes a text and returns the anonymized version along with metadata about detected entities.

  • โ€”URL: /redact
  • โ€”Method: POST
  • โ€”Headers: Content-Type: application/json
  • โ€”Body:
json
  {
    "text": "Your sensitive text here",
    "language": "auto" 
  }

(Options for language: `auto`, `en`, `fr`)

  • โ€”Success Response (200 OK):
json
  {
    "original_text": "...",
    "redacted_text": "My name is <PERSON>",
    "detected_language": "en",
    "entities": [
      {
        "type": "PERSON",
        "text": "John Doe",
        "score": 95,
        "start": 11,
        "end": 19
      }
    ]
  }
2. System Status

Checks if the API and NLP engines are online.

  • โ€”URL: /status
  • โ€”Method: GET

๐Ÿš€ Key Features

  • โ€”Multi-Language Support: High-accuracy detection for English and French using spaCy Large models.
  • โ€”Double-Pass Protection: Combines NLP-based detection with expert Regex patterns for PII coverage.
  • โ€”Expert French Recognizers: Built-in support for French-specific data: SIRET, NIR, IBAN, and addresses.
  • โ€”Balanced Anonymization: Preserves job titles and document structure to keep texts readable.
  • โ€”Minimal Dashboard: React-based UI with Risk Assessment visualization.

๐Ÿ› ๏ธ Architecture

  1. 1.Core API (`/api`): FastAPI server powered by Microsoft Presidio.
  2. 2.Web Dashboard (`/ui`): React + Vite + Tailwind CSS.

๐Ÿ“ฆ Local Development

Manual Docker commands

bash
docker compose up --build
  • โ€”API: http://localhost:8000/api
  • โ€”UI Dashboard: http://localhost:5173

๐Ÿ“„ License

MIT - Created for secure LLM workflows.