gowtham58's picture
Update app.py
3129282 verified
raw
history blame
517 Bytes
from fastai.vision.all import *
import torch
import gradio as gr
learn = torch.load('export.pkl', map_location=torch.device('cpu'))
actors = learn.dls.vocab
def classify_images(img):
pred, idx, prob = learn.predict(img)
return dict(zip(actors, map(float, prob)))
image = gr.Image(height=192, width= 192)
label = gr.Label()
examples = ['rajini.jpg', 'vijay.jpg', 'raka.jpeg', 'ajith.jpeg']
intf = gr.Interface(fn = classify_images, inputs = image, outputs=label, examples=examples)
intf.launch(inline=False)