akstrov's picture
Update app.py
0ea01b6
raw
history blame
462 Bytes
from fastai.vision.all import *
import gradio as gr
learn = load_learner('model.pkl')
breeds = tuple(learn.dls.vocab)
def classify_image(image):
pred,idx,probs = learn.predict(image)
return dict(zip(breeds,map(float,probs)))
image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
exemples = ['chihuahua.jpg','german_shepard.jpg']
intf = gr.Interface(fn = classify_image,inputs=image,outputs=label,exemples=exemples)
intf.launch(inline=False)