Skip to content

Privacy Engineering for the Generative AI era made available through a REST API

License

Notifications You must be signed in to change notification settings

DataFog/datafog-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7b76e4c · Sep 19, 2024

History

39 Commits
Jul 25, 2024
Aug 23, 2024
Aug 31, 2024
Jul 23, 2024
Jul 30, 2024
Jul 21, 2024
Jul 21, 2024
Aug 23, 2024
Jul 19, 2024
Jul 25, 2024

Repository files navigation

DataFog logo

REST API for PII detection and anonymization.

Overview

datafog-api is a REST API service that lets you detect ('annotate'), and anonymize sensitive information in your data using specialized ML models.

Getting Started:

Option 1: Install via Docker (fastest)

The fastest way to get started with datafog-api is to pull the image from Docker:

docker pull datafog/datafog-api:latest

Option 2: Build from source

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 .

Then, run the Docker container

docker run -p 8000:8000  -it datafog-api

NOTE Change the first 8000 to a new port if there is a conflict.

Documentation

You can access a user-friendly documentation site by navigating to 127.0.0.1:8000/redoc

Example cURL request/responses

Annotation

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"}
  ]
}

Anonymization (One-way)

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"}
  ]
}

Anonymization (Reversible)

Coming soon!

Advanced

Local Development

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.

Contributors

  • sroy9675
  • pselvana
  • sidmohan0

License

This software is published under the MIT license.

About

Privacy Engineering for the Generative AI era made available through a REST API

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published