Spaces:
No application file
No application file
| # AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb. | |
| # %% auto 0 | |
| __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_bike'] | |
| # %% app.ipynb 5 | |
| from fastai.vision.all import * | |
| import gradio as gr | |
| # %% app.ipynb 9 | |
| learn = load_learner('model.pkl') | |
| # %% app.ipynb 11 | |
| categories = ["giant", "specialized", "trek"] | |
| def classify_bike(image): | |
| pred,idx,probs = learn.predict(image) | |
| return dict(zip(categories, map(float,probs))) | |
| # %% app.ipynb 13 | |
| image = gr.Image(height=192, width=192, label="Bike Image") | |
| label = gr.Label(label="Predicted Bike Type") | |
| examples = ["trek.jpg", "specialized.jpg"] | |
| intf = gr.Interface(fn=classify_bike, inputs=image, outputs=label, examples=examples) | |
| intf.launch(inline=False) | |