archietram
update app.py
bb9ed36
raw history blame
No virus
973 Bytes
from fastai.vision.all import *
import gradio as gr
def get_bmi(): return _
def get_age(): return _
def combine_loss(): return _
def age_loss(): return _
def bmi_loss(): return _
learn = load_learner("export.pkl")
def classify_image(img):
tst_dl = learn.dls.test_dl(img)
preds,_ = learn.get_preds(dl=tst_dl)
result_text = "This person is " + str(round(preds[:,0].item(), 0)) + " years old with a BMI of " + str(round(preds[:,1].item(), 1)) + " kg/m^2"
return result_text
image = gr.inputs.Image()
examples = ['A00147.png','A00360.png','angela lansbury.jpg']
title = 'Predict Age and Body Mass Index from a Picture'
description = 'This app predicts the age and BMI of a person just from their face.'
article = "Author: <a href=\"https://huggingface.co/archietram\">Archie Tram</a>. "
intf = gr.Interface(fn=classify_image, inputs=image, outputs="text", examples=examples, title=title, description=description, article=article)
intf.launch(inline=False)