rafaym's picture
Update app.py
31eb1e1
raw
history blame
481 Bytes
im=PILImage.create('white people.jpg')
im.thumbnail((192,192))
learn=load_learner('model.pkl')
categories=('white people','black people')
def func_classi(img):
pred,idx,probs=learn.predict(img)
return dict(zip(categories,map(float,probs)))
func_classi(im)
import gradio as gr
image=gr.inputs.Image(shape=(192,192))
label=gr.outputs.Label()
examples=('white people','black people')
demo = gr.Interface(fn=func_classi, inputs="image", outputs="label")
demo.launch(inline=False)