facebackend / README.md
Alp İpekçiler
Add Face Analysis backend (without models)
9e3caf3
metadata
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:

{
  "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

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

License

MIT