Luis Marques
update app and include examples
16fe969
raw
history blame
634 Bytes
import warnings
from fastai.vision.all import *
import gradio as gr
warnings.simplefilter("ignore", category=UserWarning)
learn = load_learner("model.pkl")
warnings.resetwarnings()
categories = ("heavy truck", "car", "bike")
def classify_image(img):
_, _, probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
image = gr.Image()
label = gr.Label()
examples = [
"caminhao1.jpg",
"caminhao2.jpg",
"caminhao3.jpg",
"carro1.jpg",
"carro2.jpg",
"carro3.jpg",
]
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
intf.launch(inline=False)