|
__all__ = ['learning','imgclass','categories','image','label','examples','intfs'] |
|
from fastai.vision.all import * |
|
import gradio as gr |
|
|
|
learning = load_learner('model.pkl') |
|
|
|
categories = ('griz','black','ted') |
|
def imgclass(img): |
|
pred,idx,probs = learning.predict(img) |
|
return dict(zip(categories, map(float,probs))) |
|
|
|
|
|
|
|
image = gr.inputs.Image(shape=(192,192)) |
|
label = gr.outputs.Label() |
|
examples = ['dett.jpg','grizzly.jpg'] |
|
|
|
intfs = gr.Interface(fn=imgclass, inputs=image, outputs=label, examples=examples) |
|
intfs.launch(inline=False) |