# 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 # %% ../app.ipynb 12 learn = load_learner('model.pkl') # %% ../app.ipynb 18 categories = ['Godzilla', 'King Ghidorah', 'King Kong', 'Mothra', 'Rodan'] def classify_kaiju(img): pred,idx,probs=learn.predict(img) return dict(zip(categories, map(float,probs))) # %% ../app.ipynb 20 image = gr.Image() label = gr.Label() examples = ['Godzilla_1.jpg', 'Godzilla_2.jpg', 'Mothra_1.jpg', 'Mothra_2.jpg', 'King Ghidorah_1.jpg', 'King Ghidorah_2.jpg', 'KingKong_1.jpg', 'KingKong_2.jpg', 'Rodan_1.jpg', 'Rodan_2.jpg', ] intf = gr.Interface(fn=classify_kaiju, inputs=image, outputs=label, examples=examples) intf.launch(inline=False)