File size: 938 Bytes
02592f3
afde4e6
e029547
afde4e6
609686d
afde4e6
e029547
 
02592f3
 
 
 
 
e029547
 
598d7e0
02592f3
 
d25881f
e029547
 
deffedf
02592f3
deffedf
02592f3
 
 
 
 
 
 
 
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
31
32
from fastai.vision.all import *
import gradio as gr
import skimage

learn = load_learner('bearmodel.pkl')

labels = learn.dls.vocab

def predict(img):
    img = PILImage.create(img)
    pred,pred_idx,probs = learn.predict(img)
    return {labels[i]: float(probs[i]) for i in range(len(labels))}

title = "Bear Breed Classifier"
description = "A bear breed classifier trained on a custom dataset from DDG images with fastai. Created as a demo for Gradio and HuggingFace Spaces."
#interpretation ='default'
image = gr.Image(height=192, width=192)
label = gr.Label()
examples = [['black bear.jfif'], ['grizzly bear.jfif'], ['teddy bear.jfif']]


#enable_queue=True

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


#def greet(name):
#    return "Hello " + name + "!!"

#demo = gr.Interface(fn=greet, inputs="text", outputs="text")
#demo.launch()