import gradio as gr from fastai.vision.all import * #load the model learn = load_learner('nothotdog.pkl') #define the classifier function categories = ('Hot Dog', 'Not Hot Dog') def classify_image(img): pred,idx,probs = learn.predict(img) return dict(zip(categories,map(float,probs))) #Gradio interface image = gr.inputs.Image(shape=(192,192)) label = gr.outputs.Label() examples = ['1.jpg','2.jpg','3.png','4.jpg'] intf = gr.Interface(fn=classify_image,inputs=image,ouputs=label,examples=examples) intf.launch(inline=False)