Spaces:
Runtime error
Runtime error
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb. | |
# %% auto 0 | |
__all__ = ['learn', 'categories', 'image', 'label', 'intf', 'classify_images'] | |
# %% ../app.ipynb 1 | |
from fastai.vision.all import * | |
import gradio as gr | |
# %% ../app.ipynb 2 | |
learn = load_learner('country-pred-model.pkl') | |
# %% ../app.ipynb 3 | |
categories = ('mexico', 'usa') | |
def classify_images(img): | |
pred, idx, probs = learn.predict(img) | |
return dict(zip(categories, map(float, probs))) | |
# %% ../app.ipynb 6 | |
image = gr.inputs.Image() | |
label = gr.outputs.Label() | |
intf = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=('')) | |
intf.launch(inline=False) | |