firsttest / app.py
langurmonkey
Nope, still more.
b732f25 unverified
raw
history blame contribute delete
491 Bytes
import gradio as gr
from fastai.vision.all import *
def is_cat(x): return x[0].isupper()
learn = load_learner('model.pkl')
categories = ('Grizzly', 'Black', 'Teddy')
def classify_image(img):
pred,idx,probs = learn.predict(img)
return dict(zip(categories, map(float,probs)))
examples = ['grizzly.jpg', 'teddy.jpg', 'dunno.jpg']
intf = gr.Interface(
fn=classify_image,
inputs=gr.Image(height=192, width=192),
outputs=gr.Label(),
examples=examples
)
intf.launch()