Spaces:
Build error
Build error
| from fastai.vision.all import * | |
| import gradio as gr | |
| learn=load_learner('sportball.pkl') | |
| categories = ['basketball','cricket','golf','soccer','tennis','volleyball'] | |
| def classify_image(img): | |
| pred, idx, probs = learn.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| image = gr.inputs.Image(shape=(192, 192)) | |
| label = gr.outputs.Label() | |
| examples = [ | |
| 'soccer_ball.jpg', | |
| 'basketball_ball.jpg', | |
| 'volleyball.jpg', | |
| 'tennis_ball.jpg', | |
| 'golf_ball.jpg', | |
| 'cricket_ball.jpg' | |
| ] | |
| intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, title = "Sports Ball Recognition App", description = "This app could be used by an E-commerce platform to automatically categorize sport balls images uploaded by their sellers. It could help customers save time when searching for and purchasing these products.") | |
| intf.launch(inline=False) |