Srihari1611's picture
Update app.py
41ece30
raw
history blame contribute delete
495 Bytes
import gradio as gr
import fastai
from fastai.vision.all import *
learn=load_learner("Gender_classification_with 0.8751480728387833_accuracy.pkl")
categories=('female','male')
def classify_image(img):
pred,idx,probs=learn.predict(img)
return dict(zip(categories,map(float,probs)))
image=gr.inputs.Image(shape=(192,192))
label=gr.outputs.Label()
examples=['male.jpg','female.jpg']
intf=gr.Interface(fn=classify_image,inputs=image,outputs=label,examples=examples)
intf.launch(inline=False)