Spaces:
Runtime error
Runtime error
| # 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) | |