Spaces:
Sleeping
Sleeping
| import warnings | |
| from fastai.vision.all import * | |
| import gradio as gr | |
| warnings.simplefilter("ignore", category=UserWarning) | |
| learn = load_learner("model.pkl") | |
| warnings.resetwarnings() | |
| categories = ("heavy truck", "car", "bike") | |
| def classify_image(img): | |
| _, _, probs = learn.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| image = gr.Image() | |
| label = gr.Label() | |
| examples = [ | |
| "carro1.jpeg", | |
| "carro2.jpeg", | |
| ] | |
| intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
| intf.launch(inline=False) | |