Skip to content

Piiranha Server - PII Detection and Masking Service

License

Notifications You must be signed in to change notification settings

burgonet-eu/piiserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Piiranha Server

PII-Ranha Logo

PII Detection and Masking Service

A FastAPI-based service for detecting and masking Personally Identifiable Information (PII) in text using the PII-Ranha model.

Features

  • PII Detection: Check if text contains any PII
  • PII Masking: Mask detected PII with either aggregated or detailed redaction
  • Health Check: Verify service status
  • Token Chunking: Handles long texts by splitting into 256-token chunks

API Endpoints

Check PII

POST /check-pii

  • Request body: {"text": "your text here"}
  • Returns: 200 if no PII detected, 400 if PII detected

Mask PII

POST /mask-pii

  • Request body: {"text": "your text here"}
  • Optional query param: aggregate_redaction=true|false (default: true)
  • Returns: Original and masked text

Health Check

GET /health

  • Returns: Service status

Running the Service

  1. Install dependencies:
pip install fastapi uvicorn transformers torch
  1. Run the server:
python app.py
  1. The service will be available at http://localhost:8000

Testing with curl

Check for PII:

curl -X POST "http://localhost:8000/check-pii" -H "Content-Type: application/json" -d '{"text":"Your text here"}'

Mask PII:

curl -X POST "http://localhost:8000/mask-pii" -H "Content-Type: application/json" -d '{"text":"Your text here"}'

Development

The service uses the PII-Ranha model from Hugging Face.

Author & Enterprise Support

Author: Sébastien Campion

Sébastien Campion - sebastien.campion@foss4.eu

Note: This project is under active development. Please report any issues or feature requests through the issue tracker.

License

This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.