from fastai.vision.all import * import gradio as gr learn = load_learner('instrument_model.pkl'); def vocab = ['clarinet', 'french horn', 'oboe', 'oboe d amore', 'saxophone', 'trombone', 'trumpet'] def classify_image(image): pre, idx, probs = learn.predict(image) return dict(zip(vocab, probs)) image = gr.inputs.Image(shape=(250, 250)) label = gr.outputs.Label() intf = gr.Interface(fn=classify_image, inputs=image, outputs=label) intf.launch(inline=False)