Spaces:
Sleeping
Sleeping
File size: 767 Bytes
d9b7fc7 eab441e 71ab529 cbf1ce6 eab441e dcbf375 25ccd05 cbf1ce6 d487bcd eab441e b1b8573 eab441e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from fastai.vision.all import *
import gradio as gr
learn = load_learner('model.pkl')
categories = ('black', 'grizzly', 'teddy')
def classify_image(img):
pred,idx,probs = learn.predict(img)
return dict(zip(categories, map(float,probs)))
title = "Bear Classifier"
description = " Upload a picture of a bear or drag and drop one of the examples below to the upload box to find out what type of bear it is!" + "This model has been trained to identify a black bear, a grizzly bear and a teddy bear."
image = gr.Image(shape=(192,192))
label = gr.Label()
examples = ['grizzly.jpg', 'black.jpg', 'teddy.jpg']
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples = examples, title=title, description=description)
intf.launch(inline=False) |