Incostra's picture
Create app.py
aec775b verified
raw
history blame contribute delete
515 Bytes
import gradio as gr
from transformers import pipeline
# Load the age estimation model
age_model = pipeline("image-classification", model="nateraw/vit-age-classifier")
def predict_age(image):
result = age_model(image)
age = result[0]['label']
return f"Estimated Face Age: {age}"
iface = gr.Interface(
fn=predict_age,
inputs=gr.Image(type="pil"),
outputs="text",
title="Face Age Detection",
description="Upload a face and AI will estimate the age."
)
iface.launch()