File size: 458 Bytes
a0cb8c9
baa0b72
a0cb8c9
baa0b72
1688c90
a0cb8c9
baa0b72
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
from fastai.vision.all import *

learn = load_learner('export.pkl')
categories = ('damaged', 'pristine')

def predict(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()
examples = ['street04.png', 'street06.png']

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