Bittar's picture
update
6fcd5e6
raw
history blame contribute delete
655 Bytes
from fastai.vision.all import *
import pathlib
plt = platform.system()
if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
import gradio as gr
def Panther_Identifier(x): return x[0].isupper()
learn = load_learner('model.pkl')
categories = ('Leão','Onça-pintada','Leopardo','Tigre','Leopardo-das-neves')
def classify_image(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=['Panhtera_tigris.jpg','Panhtera_uncia.jpg']
intf=gr.Interface(fn=classify_image,inputs=image,outputs=label, examples=examples)
intf.launch(inline=False)