File size: 471 Bytes
5e8b157
76616f1
5e8b157
76616f1
5e8b157
 
 
 
76616f1
5e8b157
 
8f62f6a
5e8b157
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from fastai.vision.all import *
import gradio as gr
learn = load_learner('export.pkl')

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)