A self-hosted, GPU-accelerated REST API for detecting Personally Identifiable Information (PII) in text, powered by the knowledgator/gliner-pii-base-v1.0 model and served via FastAPI.
GLiNER (Generalist and Lightweight Named Entity Recognition) is a compact NER model that can identify arbitrary entity types at inference time — no task-specific fine-tuning required. Instead of being limited to a fixed set of labels, you provide the labels you want at request time and the model finds them.
gliner-pii-base-v1.0 is a variant fine-tuned specifically for PII detection tasks such as names, emails, phone numbers, addresses, and more.
restart: unless-stopped, uvicorn ASGI serverGET /healthReturns {"status": "ok"} — used by the Docker health check.
POST /predictRequest body:
{
"text": "My name is Miguel and my email is [email protected]",
"labels": ["person", "email", "phone number", "location"],
"threshold": 0.3
}
| Field | Type | Default | Description |
|---|---|---|---|
text | string | required | The input text to scan for PII |
labels | list of strings | ["person", "email", "phone number", "location"] | Entity types to detect |
threshold | float | 0.3 | Minimum confidence score (0–1) to include an entity |
Response:
{
"entities": [
{"text": "Miguel", "label": "person", "start": 11, "end": 17, "score": 0.91},
{"text": "[email protected]", "label": "email", "start": 34, "end": 52, "score": 0.97}
]
}
# Build the image (downloads model weights during build)
docker compose build
# Start the API server
docker compose up -d
# Check it's running
curl http://localhost:5000/health
# Run a prediction
curl -X POST http://localhost:5000/predict \
-H "Content-Type: application/json" \
-d '{"text": "My name is Miguel and my email is [email protected]"}'
To use the lighter/faster edge model, swap the model name in both main.py and the Dockerfile bake step:
gliner-pii-base-v1.0 → gliner-pii-edge-v1.0
.
├── main.py # FastAPI app
├── requirements.txt # Python dependencies
├── Dockerfile # CUDA-enabled container build
└── docker-compose.yml # Orchestration with GPU passthrough
A self-hosted, GPU-accelerated REST API for detecting Personally Identifiable Information (PII) in text, powered by the knowledgator/gliner-pii-base-v1.0 model and served via FastAPI.
GLiNER (Generalist and Lightweight Named Entity Recognition) is a compact NER model that can identify arbitrary entity types at inference time — no task-specific fine-tuning required. Instead of being limited to a fixed set of labels, you provide the labels you want at request time and the model finds them.
gliner-pii-base-v1.0 is a variant fine-tuned specifically for PII detection tasks such as names, emails, phone numbers, addresses, and more.
restart: unless-stopped, uvicorn ASGI serverGET /healthReturns {"status": "ok"} — used by the Docker health check.
POST /predictRequest body:
{
"text": "My name is Miguel and my email is [email protected]",
"labels": ["person", "email", "phone number", "location"],
"threshold": 0.3
}
| Field | Type | Default | Description |
|---|---|---|---|
text | string | required | The input text to scan for PII |
labels | list of strings | ["person", "email", "phone number", "location"] | Entity types to detect |
threshold | float | 0.3 | Minimum confidence score (0–1) to include an entity |
Response:
{
"entities": [
{"text": "Miguel", "label": "person", "start": 11, "end": 17, "score": 0.91},
{"text": "[email protected]", "label": "email", "start": 34, "end": 52, "score": 0.97}
]
}
# Build the image (downloads model weights during build)
docker compose build
# Start the API server
docker compose up -d
# Check it's running
curl http://localhost:5000/health
# Run a prediction
curl -X POST http://localhost:5000/predict \
-H "Content-Type: application/json" \
-d '{"text": "My name is Miguel and my email is [email protected]"}'
To use the lighter/faster edge model, swap the model name in both main.py and the Dockerfile bake step:
gliner-pii-base-v1.0 → gliner-pii-edge-v1.0
.
├── main.py # FastAPI app
├── requirements.txt # Python dependencies
├── Dockerfile # CUDA-enabled container build
└── docker-compose.yml # Orchestration with GPU passthrough