https://github.com/datafog/datafog-api
Privacy Engineering for the Generative AI era made available through a REST API
https://github.com/datafog/datafog-api
Last synced: 4 months ago
JSON representation
Privacy Engineering for the Generative AI era made available through a REST API
- Host: GitHub
- URL: https://github.com/datafog/datafog-api
- Owner: DataFog
- License: mit
- Created: 2024-07-18T17:11:10.000Z (10 months ago)
- Default Branch: dev
- Last Pushed: 2024-09-19T12:39:58.000Z (8 months ago)
- Last Synced: 2024-11-10T23:24:47.957Z (6 months ago)
- Language: Python
- Homepage: https://datafog.ai
- Size: 62.5 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
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:
```sh
docker pull datafog/datafog-api:latest
```### Option 2: Build from source
Alternatively, you can clone this repository and build the image locally:
```sh
git clone https://github.com/datafog/datafog-api.git
``````sh
cd datafog-api/
docker build -t datafog-api .
```### Then, run the Docker container
```sh
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:
```sh
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:
```sh
{
"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:
```sh
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:
```sh
{
"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
```sh
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 [email protected].
### Contributors
- sroy9675
- pselvana
- sidmohan0# License
This software is published under the [MIT
license](https://en.wikipedia.org/wiki/MIT_License).