RubenAMtz's picture
Update app.py
1688c90
raw
history blame
458 Bytes
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)