Spaces:
Sleeping
Sleeping
__all__ = ['learn', 'categories', 'classify_image', 'input_image', 'labels', 'intf'] | |
from fastai.vision.all import * | |
import gradio | |
import nbdev | |
learn = load_learner('fast-food-model.pkl') | |
categories = ('Baked Potato', 'Burger', 'Crispy Chicken', 'Donut', 'Fries','Hot Dog','Pizza','Sandwich','Taco','Taquito') | |
def classify_image (image): | |
pred,idx,probs = learn.predict(image) | |
return dict(zip(categories, map(float, probs))) | |
input_image = gradio.inputs.Image(shape=(192, 192)) | |
labels = gradio.outputs.Label() | |
intf = gradio.Interface(fn = classify_image, inputs = input_image, outputs = labels) | |
intf.launch(inline = False) | |