beaverdam / app.py
dylanmcc's picture
Formatting output
320c999
raw
history blame contribute delete
427 Bytes
import gradio as gr
from fastai.vision.all import load_learner
learner = load_learner('saved_model/beaverdam.pkl')
categories = ('Beaver Dam', 'Not a Beaver Dam')
def is_it_a_beaver_dam(input_img):
pred, idx, probs = learner.predict(input_img)
return f'{pred} {dict(zip(categories, map(float, probs)))}'
demo = gr.Interface(fn=is_it_a_beaver_dam, inputs=gr.Image(shape=(200, 200)), outputs=gr.Label())
demo.launch()