import gradio as gr from fastai.vision.all import * learn = load_learner('./tree-classifier.pkl') def predict(image): leaf_type,_,probs = learn.predict(image) return f"This is a: {leaf_type}. \nProbability it's a {leaf_type}: {probs.max():.4f}" iface = gr.Interface(fn=predict, inputs="image", outputs="text") iface.launch()