File size: 466 Bytes
96af3d3
 
 
fb3ce18
96af3d3
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from fastai.vision.all import * 
import gradio as gr

learn = load_learner('AIReco1.pkl')

guesting = ('bird','forest')
def prediction(img):
    pred,idx,probs = learn.predict(PILImage.create(img))
    return dict(zip(guesting, map(float,probs)))


image = gr.inputs.Image(shape=(192, 192))
label = gr.outputs.Label()
examples = ['bird7.jpg', 'forest3.jpg']
intf = gr.Interface(fn=prediction, inputs=image, outputs=label, examples=examples)
intf.launch(inline=False)