Spaces:
Sleeping
Sleeping
File size: 718 Bytes
232919e e1afb6d 0ab2494 386df88 0ab2494 e1afb6d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
__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()
|