File size: 1,660 Bytes
350a321
 
 
 
 
 
 
 
 
 
 
 
 
b907abc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Lifespan Predictor
emoji: 📚
colorFrom: red
colorTo: pink
sdk: gradio
sdk_version: 5.44.1
app_file: app.py
pinned: false
license: mit
short_description: remaining lifespan predictor
---

# 🧑‍⚕️ Lifespan Prediction Demo

This is a **Gradio app** that predicts the **remaining lifespan (in years)** from a face image using a fine-tuned [DINOv2](https://github.com/facebookresearch/dinov2) model.  
The model was trained on the [Remaining Lifespan Prediction Faces](https://huggingface.co/datasets/TristanKE/RemainingLifespanPredictionFaces) dataset.

---

## 🚀 How it works
- Upload a face photo **or** use your **webcam**.  
- The model extracts features with a **DINOv2 ViT-L backbone**.  
- A regression head outputs the predicted **remaining lifespan (years)**.  

---

## 🖥️ Usage
1. Click **“Use Webcam”** or **“Upload Image”**.  
2. Wait a few seconds for processing (faster on GPU).  
3. The result will be shown in the output box:  
    Estimated remaining lifespan: XX.X years

---

## ⚙️ Technical Details
- Backbone: `dinov2_vitl14_reg` (frozen during training)  
- Hidden dimension: `128`  
- Loss: **Heteroscedastic Negative Log Likelihood (NLL)**  
- Best checkpoint saved during training → uploaded to [Model Hub](https://huggingface.co/SiyaYan/lifespan-predictor).  

---

## 📦 Files in this Space
- `app.py` → Gradio app definition  
- `requirements.txt` → dependencies  
- `README.md` → this file  

---

## ⚠️ Disclaimer
This demo is for **research and educational purposes only**.  
Predictions are **not medical advice** and should not be used in real-world decision-making.  

---