File size: 1,395 Bytes
61f2517
9e3caf3
 
 
 
61f2517
 
 
 
 
9e3caf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
title: Face Analysis API
emoji: 👤
colorFrom: purple
colorTo: pink
sdk: docker
pinned: false
license: mit
---

# Face Analysis API

This is a Node.js/Express API for face analysis using face-api.js with TensorFlow.js.

## Features

- 👤 Face detection using SSD MobileNet V1
- 😊 Facial expression recognition
- 🎂 Age estimation
- ⚧️ Gender prediction
- 📍 68-point facial landmarks
- 🌐 CORS enabled for web applications

## API Endpoints

### POST /predict_face
Upload an image to get face analysis.

**Request:**
- Method: POST
- Content-Type: multipart/form-data
- Body: `image` file

**Response:**
```json
{
  "age": 25,
  "gender": "male",
  "genderProbability": 0.95,
  "expressions": {
    "neutral": 0.7,
    "happy": 0.2,
    "sad": 0.05,
    "angry": 0.02,
    "fearful": 0.01,
    "disgusted": 0.01,
    "surprised": 0.01
  },
  "detection": {
    "box": {
      "x": 100,
      "y": 50,
      "width": 200,
      "height": 250
    }
  },
  "landmarks": [
    {"x": 120, "y": 100},
    ...
  ],
  "imageDimensions": {
    "width": 640,
    "height": 480
  }
}
```

## Models

Uses pre-trained face-api.js models:
- SSD MobileNet V1 for face detection
- Face Landmark 68 Net
- Face Recognition Net
- Face Expression Net
- Age Gender Net

## Usage

```bash
curl -X POST -F "image=@face.jpg" https://alpingo23-facebackend.hf.space/predict_face
```

## License

MIT