Spaces:
Sleeping
Sleeping
File size: 748 Bytes
8b6da13 1a3bb12 8b6da13 1a3bb12 8b6da13 |
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__ = ['learner', 'categories', 'image', 'label', 'examples', 'intf', 'calssify_images']
# %% app.ipynb 2
from fastai.vision.all import *
import gradio as gr
# %% app.ipynb 3
learner = load_learner('model.pkl')
categories = ('Bird', 'Drone')
def calssify_images(img):
pred, idx, probs = learner.predict(img)
return dict(zip(categories, map(float, probs)))
# %% app.ipynb 4
image = gr.inputs.Image(shape = (192, 192))
label = gr.outputs.Label()
examples = ['BirdExample1.jpg', 'BirdExample2.jpg', 'DroneExample1.jpg', 'DroneExample2.jpg']
intf = gr.Interface(fn = calssify_images, inputs = image, outputs = label, examples = examples)
intf.launch(inline = False)
|