neatclf / app.py
sl207's picture
Update app.py
3453836 verified
raw
history blame contribute delete
359 Bytes
import gradio as gr
from fastai.vision.all import *
import skimage
learn = load_learner('model.pkl')
labels = learn.dls.vocab
def predict(image):
image = PILImage.create(image)
brand, idx, probs = learn.predict(image)
return dict(zip(labels, map(float,probs)))
demo = gr.Interface(fn=predict, inputs=gr.Image(), outputs=gr.Label())
demo.launch()