# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb. # %% auto 0 __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_kaiju'] # %% ../app.ipynb 1 from fastai.vision.all import * import gradio as gr def godzilla_or_kingkong(x): return x[0].isupper # %% ../app.ipynb 11 learn = load_learner('model.pkl') # %% ../app.ipynb 14 categories = ['Godzilla', 'King Kong'] def classify_kaiju(img): pred,idx,probs=learn.predict(img) return dict(zip(categories, map(float,probs))) # %% ../app.ipynb 16 image = gr.Image() label = gr.Label() examples = ['Godzilla_1.jpg', 'KingKong_1.jpg', 'Godzilla_2.jpg', 'KingKong_2.jpg'] intf = gr.Interface(fn=classify_kaiju, inputs=image, outputs=label, examples=examples) intf.launch(inline=False)