Spaces:
Runtime error
Runtime error
File size: 777 Bytes
dd60816 1e47a5f dd60816 5756aa4 dd60816 5756aa4 dd60816 1e47a5f dd60816 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# 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)
|