Spaces:
Runtime error
Runtime error
File size: 788 Bytes
1113c61 b74f6cb 39dab49 b74f6cb b385913 0e37ab7 b385913 b74f6cb 3657439 1113c61 3657439 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 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)
|