| .vscode | ||
| src | ||
| .gitignore | ||
| bun.lock | ||
| Dockerfile | ||
| eslint.config.js | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
Deface API
This project provides a simple API endpoint to anonymize faces in images using the deface library. The API is built with ElysiaJS and runs on Bun.
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Prerequisites
You need to have Bun installed on your machine.
Installation
-
Clone the repository:
git clone https://github.com/your-username/deface-api.git cd deface-api -
Install the dependencies:
bun install -
Run the development server:
bun run devThe server will be running on
http://localhost:3000.
Usage
To use the API, send a POST request to the /deface endpoint with the image you want to anonymize. The image should be sent as a multipart form data with the key image.
Here's an example using curl:
curl -X POST -F "image=@/path/to/your/image.jpg" http://localhost:3000/deface -o defaced-image.jpg
API Reference
POST /deface
Anonymizes faces in the provided image.
Request:
- Method:
POST - Endpoint:
/deface - Body:
multipart/form-dataimage: The image file to be processed.
Response:
- Success (200 OK):
- Content-Type:
image/jpeg - Body: The anonymized image.
- Content-Type:
- Error (400 Bad Request):
- Body: "Image file is required"
Docker
You can also run the application using Docker.
-
Build the Docker image:
docker build -t deface-api . -
Run the Docker container:
docker run -p 3000:3000 deface-api
The API will be available at http://localhost:3000.