File size: 493 Bytes
252400c
4ad0ead
 
252400c
 
 
4ad0ead
252400c
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from fastai.vision.all import * 
import gradio as gr

def classify_image(img):
    prediction,idx,probs = learn.predict(img)
    return prediction

learn = load_learner("model.pkl")
image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
examples = ["./testImages/Jim.jpg", "./testImages/Pam.jpg", "./testImages/Ryan.jpg", "./testImages/Scott.jpg", "./testImages/Stanley.jpg"]

intf = gr.Interface(fn = classify_image, inputs=image, outputs=label, examples=examples)
intf.launch()