gradioApp1 / app.py
zachfster's picture
update app
00c1765
raw
history blame
477 Bytes
from fastai.vision.all import *
import gradio as gr
learn = load_learner('hdmodel.pkl')
categories = ('sausage', 'hotdog', 'pepperoni', 'salami', 'chorizo', 'bratwurst', 'kielbasa')
def classify_image(img):
pred,idx,probs = learn.predict(img)
return dict(zip(categories, map(float,probs)))
image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
intf.launch(inline=False)