Spaces:
Sleeping
Sleeping
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb. | |
# %% auto 0 | |
__all__ = ['learn', 'image', 'label', 'examples', 'intf', 'classify_image'] | |
# %% ../app.ipynb 3 | |
from fastai.vision.all import * | |
import gradio as gr | |
# %% ../app.ipynb 7 | |
learn = load_learner('export.pkl') | |
# %% ../app.ipynb 13 | |
def classify_image(img): | |
pred,pred_idx,probs = learn.predict(img) | |
return dict(zip(learn.dls.vocab, map(float, probs))) | |
# %% ../app.ipynb 18 | |
image = gr.components.Image(height=192, width=192) | |
label = gr.components.Label() | |
examples = ['cat.jpg', 'dog.jpg'] | |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
intf.launch(inline=False) | |