Spaces:
Sleeping
Sleeping
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb. | |
# %% auto 0 | |
__all__ = ['learn', 'labels', 'image', 'label', 'examples', 'intf', 'classify_image'] | |
# %% app.ipynb 1 | |
!pip install -Uqq fastai | |
# %% app.ipynb 2 | |
from fastai.vision.all import * | |
import gradio as gr | |
# %% app.ipynb 4 | |
learn = load_learner('eh_native_plants.pkl') | |
# %% app.ipynb 7 | |
labels = learn.dls.vocab | |
def classify_image(img): | |
pred,pred_idx,probs = learn.predict(img) | |
return dict(zip(labels, map(float, probs))) | |
# %% app.ipynb 9 | |
image = gr.Image(shape=(192,192)) | |
label = gr.Label() | |
examples = ['ind_grass.jpg', 'reed.jpg'] | |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, example=examples) | |
intf.launch(inline=False) | |