File size: 1,002 Bytes
379886f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: "Detect4Enhance Backend"
emoji: "🤖"
colorFrom: blue
colorTo: green
sdk: docker
sdk_version: "latest"
app_file: app.py
pinned: false
---


# Engagement Detection API

A Flask-based API for detecting engagement levels from facial expressions using TensorFlow Lite.

## API Endpoints

- `GET /`: Returns API information
- `POST /predict`: Accepts an image file and returns engagement predictions

## Deployment

1. Clone this repository
2. Build Docker image: `docker build -t engagement-api .`
3. Run container: `docker run -p 7860:7860 engagement-api`

## Example Usage

```python
import requests

url = "https://your-huggingface-space-url.hf.space/predict"
files = {'image': open('test.jpg', 'rb')}
response = requests.post(url, files=files)
print(response.json())
```

## Model Details

- Model: Custom TensorFlow Lite model (`engagement_model_89.tflite`)
- Input: 224x224 RGB face image
- Output: Probabilities for 4 engagement states:
  - Engaged
  - Frustrated
  - Bored
  - Confused