File size: 2,136 Bytes
e2e75ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: TangoBot
emoji: 📸
colorFrom: red
colorTo: yellow
sdk: gradio
python_version: "3.12"
app_file: app.py
pinned: false
---

# TangoBot

Gradio web UI for face detection and age estimation, designed for HuggingFace Spaces deployment. This demo showcases TangoBot's photo analysis capabilities for [Tango Charities](https://www.tangocharities.org/).

## About Tango Charities

Tango Charities is a volunteer-led nonprofit fighting hunger through Feed The City events. Since 2015, they've mobilized 110,000+ volunteers to provide 8+ million meals across 73 cities. TangoBot helps the team count attendees in event photos and identify youth participation.

## Features

- Interactive web interface for image upload
- Real-time face detection and age estimation
- Webcam and clipboard support
- Embeds inference directly (no external HTTP calls)

## Running Locally

```bash
cd apps/huggingface-space
uv run gradio app.py
```

Opens at http://localhost:7860

## Usage

1. Upload an image (or use webcam/clipboard)
2. View the annotated image with face bounding boxes
3. See detection results:
   - Number of faces detected
   - Count of people estimated under 18

## Color Coding

Bounding boxes are color-coded:
- **Green**: Under 18 (minors)
- **Blue**: 18 and older (adults)

## Deploying to HuggingFace Spaces

1. Create a new Space on HuggingFace (Gradio SDK)
2. Copy the package source and app files:
   ```
   packages/face-age-inference/src/face_age_inference/ -> face_age_inference/
   apps/huggingface-space/app.py -> app.py
   apps/huggingface-space/requirements.txt -> requirements.txt
   ```
3. Push to the Space repository

Models are automatically downloaded from HuggingFace Hub on first run (~450MB).

## Requirements

See `requirements.txt` for dependencies. Key packages:
- `gradio>=5.0.0` - Web UI framework
- `torch>=2.9.1` - PyTorch
- `transformers>=4.51.0` - HuggingFace Transformers
- `ultralytics>=8.3.230` - YOLO implementation

## Configuration

The app uses default settings from `face-age-inference`. To customize, modify environment variables:

```bash
FACE_AGE_DEVICE=cuda:0 uv run gradio app.py
```