REST API for PII detection and anonymization.
datafog-api is a REST API service that lets you detect ('annotate'), and anonymize sensitive information in your data using specialized ML models.
The fastest way to get started with datafog-api is to pull the image from Docker:
docker pull datafog/datafog-api:latest
Alternatively, you can clone this repository and build the image locally:
git clone https://github.com/datafog/datafog-api.git
cd datafog-api/
docker build -t datafog-api .
docker run -p 8000:8000 -it datafog-api
NOTE Change the first 8000 to a new port if there is a conflict.
You can access a user-friendly documentation site by navigating to 127.0.0.1:8000/redoc
Request:
curl -X POST http://127.0.0.1:8000/api/annotation/default \
-H "Content-Type: application/json" \
-d '{"text": "My name is Peter Parker. I live in Queens, NYC. I work at the Daily Bugle."}'
Response:
{
"entities": [
{"text": "Peter Parker", "start": 11, "end": 23, "type": "PER"},
{"text": "Queens", "start": 35, "end": 41, "type": "LOC"},
{"text": "NYC", "start": 43, "end": 46, "type": "LOC"},
{"text": "the Daily Bugle", "start": 58, "end": 73, "type": "ORG"}
]
}
Request:
curl -X POST http://127.0.0.1:8000/api/anonymize/non-reversible \
-H "Content-Type: application/json" \
-d '{"text": "My name is Peter Parker. I live in Queens, NYC. I work at the Daily Bugle."}'
Response:
{
"text": "My name is [PER]. I live in [LOC], [LOC]. I work at [ORG].",
"entities": [
{"text": "Peter Parker", "start": 11, "end": 23, "type": "PER"},
{"text": "Queens", "start": 35, "end": 41, "type": "LOC"},
{"text": "NYC", "start": 43, "end": 46, "type": "LOC"},
{"text": "the Daily Bugle", "start": 58, "end": 73, "type": "ORG"}
]
}
Coming soon!
git clone https://github.com/datafog/datafog-api.git
cd datafog-api/
python -m venv myenv
source myenv/bin/activate
cd app
pip install -r requirements-dev.txt
uvicorn main:app
NOTE datafog-api requires Python 3.11+. If you require support for other versions, please email us at hi@datafog.ai.
- sroy9675
- pselvana
- sidmohan0
This software is published under the MIT license.