Test / app.py
goatman's picture
fix path
d45ed02
raw
history blame contribute delete
441 Bytes
import gradio as gr
from fastbook import *
learn = load_learner('./model (1).pkl')
def predict(img):
categories = learn.dls.vocab
img = PILImage.create(img)
category, idx, likelyhoods = learn.predict(img)
return dict(zip(categories, map(float, likelyhoods)))
img = gr.inputs.Image(shape=(192, 192))
label = gr.outputs.Label()
intf = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=label).launch()