test_space / app.py
danieladejumo's picture
Updated app.py
bccd5fd
raw
history blame
502 Bytes
import gradio as gr
from fastai.vision.all import *
learn = load_learner("bird_or_forest.pkl")
classes = ["Bird", "Forest"]
def classify_images(im):
cat, idx, probs = learn.predict(im)
return dict(zip(classes, map(float, probs)))
image = gr.Image(height=192, width=192)
label = gr.Label()
examples = ["forest.jpg", "bird.jpg"]
iface = gr.Interface(fn=classify_images,
inputs=image,
outputs=label,
examples=examples)
iface.launch()