CoolFace
Apppublic

Solab/Sample_vehicles

sourceHugging Faceupdated 4y agoView on Hugging Face
0likes
app.py26 linesDownload Raw Back to root
1# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.2 3# %% auto 04__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'inter', 'classify_image']5 6# %% app.ipynb 37from fastai.vision.all import *8import gradio as gr9 10# %% app.ipynb 511learn = load_learner('model.pkl')12 13# %% app.ipynb 714categories = ('bicycle', 'car', 'plane', 'train')15 16def classify_image(img):17    preds, idx, probs = learn.predict(img)18    return dict(zip(categories, map(float, probs)))19 20# %% app.ipynb 921image = gr.inputs.Image(shape=(192, 192))22label = gr.outputs.Label()23examples = ['car.jpg', 'plane.jpg']24inter = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)25inter.launch(inline=False, share=True)26