bearId / app.py
Spartanbell's picture
Cleanup Interface
b3c7727
raw
history blame contribute delete
764 Bytes
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()