satish860's picture
Initial checkin with example
14a241f
raw
history blame
490 Bytes
import gradio as gr
from fastai.vision.all import *
learner = load_learner('model.pkl')
categories = learn.dls.vocab
def predict(img):
preds,idx,probs = learner.predict(img)
return dict(zip(categories,map(float,probs)))
examples = ['Arborio.jpg','Basmati.jpg','Ipsala.jpg','Jasmine.jpg']
demo = gr.Interface(fn=predict,
inputs=gr.inputs.Image(shape=(224, 224)),
outputs= gr.outputs.Label()
)
demo.launch(inline=False)