File size: 426 Bytes
b2c85db |
1 2 3 4 5 6 7 8 9 10 11 12 |
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) |