Spaces:
Sleeping
Sleeping
| from fastai.vision.all import * | |
| import gradio as gr | |
| learn = load_learner("cat_or_dog.pkl") | |
| categories = ("cat", "dog") | |
| def classify(img): | |
| pred, idx, probs = learn.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| image = gr.Image(height=512, width=512) | |
| label = gr.Label() | |
| examples = ["tiger.jpg", "cat.jpg", "c1.jpg"] | |
| intf = gr.Interface(fn=classify, inputs=image, outputs=label, examples=examples) | |
| intf.launch(inline=False) | |