alperenunlu's picture
Init commit
78790a7
raw
history blame contribute delete
403 Bytes
import gradio as gr
from fastai.vision.all import *
learn = load_learner("cat.pkl")
classes = learn.vocab
examples = learn.examples
def classify_image(img):
probs = learn.predict(img)[2]
return dict(zip(classes, map(float, probs)))
image = gr.Image()
label = gr.Label(num_top_classes=5)
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
intf.launch()