Spaces:
Sleeping
Sleeping
File size: 764 Bytes
c78556a e3e5400 a3f709e cc7ac56 a3f709e c392f55 d41d568 f0e2cf2 bd97228 f0e2cf2 3571ea0 a72d82f f0e2cf2 b3c7727 f0e2cf2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from fastai.vision.all import *
import gradio as gr
learn = load_learner('bear_export.pkl')
categories = ('Black', 'Grizzly', 'Teddy')
def classify_image(img):
pred,idx,probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
image = gr.Image(width=192,height=192)
label = gr.Label()
demo = gr.Interface(fn=classify_image,
inputs=image,
outputs=label,
examples=["Grizzly.jpg", "Black.jpg", "Teddy.png"],
title="Bear Classifier",
description="Upload an Image to Test")
demo.launch(inline=False)
# def greet(name):
# return "Hello - " + name + "!!"
# demo = gr.Interface(fn=greet, inputs="text", outputs="text")
# demo.launch() |