Spaces:
Runtime error
Runtime error
| 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) |