Spaces:
Sleeping
Sleeping
| __all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'demo'] | |
| from fastai.vision.all import * | |
| import gradio as gr | |
| examples = ['images/cloud1.jpg', 'images/cloud2.jpg', 'images/cloud3.jpg', 'images/cloud4.jpg', 'images/cloud5.jpg', 'images/cloud6.jpg', 'images/cloud7.jpg', 'images/cloud8.jpg', 'images/cloud9.jpg', 'images/cloud10.jpg', 'images/cloud15.jpg'] | |
| categories = ('Cirrus', 'Stratus') | |
| learn = load_learner('model.pkl') | |
| def classify_image(img): | |
| pred,idx,probs = learn.predict(img) | |
| return dict(zip(categories, map(float,probs))) | |
| image = gr.Image() | |
| label = gr.Label() | |
| demo = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
| demo.launch() | |