https://github.com/pubkey/face-api-docker-http
A microservice for face-api.js to detect faces in images via HTTP requests
https://github.com/pubkey/face-api-docker-http
Last synced: 5 months ago
JSON representation
A microservice for face-api.js to detect faces in images via HTTP requests
- Host: GitHub
- URL: https://github.com/pubkey/face-api-docker-http
- Owner: pubkey
- License: mit
- Created: 2021-01-21T20:18:38.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-30T06:11:33.000Z (over 4 years ago)
- Last Synced: 2025-06-07T14:05:58.931Z (7 months ago)
- Language: TypeScript
- Size: 10.6 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# face-api-docker-http
A microservice for face-api.js to detect faces in images via HTTP requests
Runs [face-api.js](https://github.com/justadudewhohacks/face-api.js/) together with an express server.
Docker compose:
```yml
face-api:
build: https://github.com/pubkey/face-api-docker-http.git
ports:
- "5006:5006"
```
Example curl request:
```bash
curl \
-F 'image=@./face.jpg' \
-f http://localhost:5006/upload > out.json
```
Example request with [got](https://github.com/sindresorhus/got):
```typescript
const buffer = await fs.readFileSync(path.join(__dirname, 'face.jpg'));
const base64data = buffer.toString('base64');
const postData = {
image: base64data
};
const response = await got.post({
url: 'http://localhost:5006/base64',
responseType: 'json',
json: postData
});
```
Example result:
```json
[
{
detection: {
_imageDims: [Object],
_score: 0.6555111617967467,
_classScore: 0.6555111617967467,
_className: '',
_box: [Object]
},
landmarks: { _imgDims: [Object], _shift: [Object], _positions: [Array] },
unshiftedLandmarks: { _imgDims: [Object], _shift: [Object], _positions: [Array] },
alignedRect: {
_imageDims: [Object],
_score: 0.6555111617967467,
_classScore: 0.6555111617967467,
_className: '',
_box: [Object]
},
gender: 'male',
genderProbability: 0.9573085904121399,
age: 30.663358688354492
}
]
```