Spaces:
Runtime error
Runtime error
File size: 547 Bytes
14a241f 22784ab 14a241f 8dcc4d3 14a241f bdb2cfa 14a241f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
from fastai.vision.all import *
learner = load_learner('model.pkl')
categories = learner.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','Karacadag.jpg']
demo = gr.Interface(fn=predict,
inputs=gr.inputs.Image(shape=(224, 224)),
outputs= gr.outputs.Label(),
examples=examples
)
demo.launch(inline=False) |