Spaces:
Sleeping
Sleeping
File size: 830 Bytes
6ffed6b 8321645 6ffed6b 8f20dcb 6ffed6b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from fastai.vision.all import *
import gradio as gr
# Cell
learn = load_learner('resnet101model_2.pkl')
# Cell
categories = ("anna's", 'green-crowned', 'marvelous spatuletail', 'ruby-throated', 'violetear')
def classify_image(img):
pred,idx,probs = learn.predict(img)
return dict(zip(categories, map(float,probs)))
# Cell
image = gr.inputs.Image(shape=(224, 224))
label = gr.outputs.Label()
examples = ['annas.jpeg', 'green-crowned.jpeg', 'marvelous_spatuletail.png', 'ruby-throated.jpeg', 'violetear.jpeg']
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, description="A Hummingbird classifier with a 90% accuracy. The following are the possible categories the model can predict: anna's, green-crowned, marvelous spatuletail, ruby-throated, violetear")
intf.launch(inline=False) |