Spaces:
Runtime error
Runtime error
File size: 649 Bytes
3052b88 |
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', '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)
|