Spaces:
Build error
Build error
import gradio as gr | |
from fastcore.all import * | |
import time | |
from fastai.vision.all import * | |
image = gr.inputs.Image(shape=(192,192)) | |
label = gr.outputs.Label() | |
examples = ['bmw_750.jpeg'] | |
categories = ['bmw car', 'mercedes car'] | |
learn = load_learner("export.pkl") | |
def classify_image(img): | |
pred, _, prob = learn.predict(img) | |
return dict(zip(categories, map(float, probs))) | |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
intf.launch(inline=False) | |