File size: 359 Bytes
f0bf05f ba7f700 f0bf05f dcc7f81 3453836 dcc7f81 c25e9fc dcc7f81 f0bf05f dcc7f81 f0bf05f |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
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() |