File size: 733 Bytes
025c5a6
fd19668
adf0fb6
025c5a6
079f4db
025c5a6
6dce996
079f4db
 
fd19668
079f4db
 
 
 
 
e4fa77d
1690e89
fd19668
 
079f4db
fd19668
079f4db
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
import skimage
from fastai.vision.all import *

learn = load_learner('model.pkl')

categories = ('Coyote','Dog','Fox','Wolf')

def classify_image(img):
    img = PILImage.create(img)
    pred,idx,probs = learn.predict(img)
    return dict(zip(categories, map(float,probs)))

image = gr.inputs.Image(shape=(192, 192))
label = gr.outputs.Label()
interpretation='default'
examples = ['Dog.jpg','Wolf.jpg','Fox.jpg','Coyote.jpg']
title = "Wolf-like Animal Classifier"
description = "A wolf-like animal classifier trained with fastai."

intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, description=description, title=title, interpretation=interpretation)
intf.launch(inline=False)