first-model / app.py
Lucas Lima
fix gradio components
b37836e
Raw History Blame Contribute Delete
545 Bytes
import gradio as gr
from fastai.vision.all import *
learn = load_learner('model.pkl')
categories = ('Golf', 'Soccer')
def classify_image(img):
pred,idx,probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
image = gr.Image() # No need for the shape argument
label = gr.Label()
iface = gr.Interface(fn=classify_image, inputs=image, outputs=label)
iface.launch(inline=False)
# def greet(name):
# return "Hello " + name + "!!"
# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
# iface.launch()