Spaces:
Sleeping
Sleeping
from fastai.vision.all import * | |
import gradio as gr | |
categories = 'Giant panda', 'Red panda' | |
def classify_image(img): | |
pred, idx, probs = learn.predict(img) | |
return dict(zip(categories, map(float, probs))) | |
learn = load_learner('model.pkl') | |
image = gr.Image(height=192, width=192) | |
label = gr.Label() | |
examples = ['giant_0.jpg', 'red_0.jpg', 'giant_1.jpg', 'red_1.jpg'] | |
interface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
interface.launch(inline=False) |