from fastai.vision.all import * | |
import gradio as gr | |
learn = load_learner('ball.pkl') | |
def classify_image (img): | |
ball,_,probs = learn.predict(img) | |
return (f"This is a: {ball}") | |
image = gr.inputs.Image(shape=(192,192)) | |
label = gr.outputs.Label() | |
examples = ['bowling.jpg','golf.jpg','volleyball.jpg'] | |
intf = gr.Interface(fn = classify_image, inputs = image, outputs = label, examples = examples) | |
intf.launch(inline = False) |