asquirous's picture
Update app.py to accommodate the new model
17086e3
raw
history blame
433 Bytes
from fastai.vision.all import *
import gradio as gr
learn = load_learner("model_bicycles.pkl")
labels = learn.dls.vocab
def classify_image(img):
img = PILImage.create(img)
pred, idx, probs = learn.predict(img)
return dict(zip(labels, map(float, probs)))
image = gr.inputs.Image(shape=(224, 224))
label = gr.outputs.Label()
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
intf.launch(inline=False)