Spaces:
Sleeping
Sleeping
File size: 869 Bytes
b83c6b6 2c34937 b83c6b6 a1d66c5 00c4f9e b83c6b6 |
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 |
# 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)
|