Spaces:
Runtime error
Runtime error
import gradio as gr | |
from fastai.vision.all import * | |
#load the model | |
learn = load_learner('nothotdog.pkl') | |
#define the classifier function | |
categories = ('HotDog', 'Not HotDog') | |
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,outputs=label,examples=examples) | |
intf.launch(inline=False) | |