Spaces:
Runtime error
Runtime error
| from fastai.vision.all import * | |
| import gradio as gr | |
| learn = load_learner('export.pkl') | |
| categories = ('Big Truck','Bus','Car','Military Vehicle', | |
| 'Motorcycle','Pickup truck','Van') | |
| def classify_image(img): | |
| pred,idx,probs = learn.predict(img) | |
| return dict(zip(categories, map(float,probs))) | |
| examples = [] | |
| path = Path('Test') | |
| if path.exists(): | |
| for img in path.glob('**/*.jpg'): | |
| examples.append(str(img)) | |
| image = gr.inputs.Image(shape=(192,192)) | |
| label = gr.outputs.Label() | |
| intf = gr.Interface(fn=classify_image, inputs=image, outputs=label,examples=examples) | |
| intf.launch(inline=True) |