Spaces:
Runtime error
Runtime error
File size: 545 Bytes
74c8102 e5472cf 74c8102 11fad6c 74c8102 e5472cf b37836e e5472cf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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() |