import gradio as gr from fastai.vision.all import * import skimage learn = load_learner('model.pkl') categories = 'possum', 'rat' def classify_image(img): pred,idx,probs = learn.predict(img) return dict(zip(categories, map(float,probs))) title = "Pest Classifier" description = "This model classifies images of pests into 2 categories: 'Possum' or 'Rat'" article="This is just me following the lesson 2 of the fastai course. I used the siamese network to classify the pests." examples = ['possum.jpg', 'rat.jpg'] interpretation='default' enable_queue=True interface = gr.Interface( fn=classify_image, inputs=gr.Image(), outputs=gr.Label(), title=title, description=description, article=article, examples=examples ) interface.launch(share=True)