Spaces:
Runtime error
Runtime error
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb. | |
# %% auto 0 | |
__all__ = ['learn', 'categories', 'image', 'label', 'interface', 'predict'] | |
# %% app.ipynb 3 | |
from fastai.vision.all import * | |
import gradio as gr | |
# %% app.ipynb 4 | |
learn = load_learner('lamborghini_vs_mercedes_model.pkl') | |
# %% app.ipynb 5 | |
categories = ('lamborghini', 'mercedes') | |
def predict(img): | |
pred, idx, prob = learn.predict(img) | |
return dict(zip(categories, map(float, prob))) | |
# %% app.ipynb 7 | |
image = gr.inputs.Image(shape=(192,192)) | |
label = gr.outputs.Label() | |
interface = gr.Interface(fn=predict, inputs=image, outputs=label, examples=['lambo1.jpg', 'mercedes1.jpg']) | |
interface.launch(inline=False) | |