import gradio as gr from fastai.vision.all import * import skimage learn = load_learner("export.pkl") def predict(img): img = PILImage.create(img) pred, pred_idx, probs = learn.predict(img) result = f"Prediction: {pred}; Probability: {probs[pred_idx]:.04f}" return result gr.Interface( fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3), title="Saving the silkies", description="A pigeon/silkie classifier. Create as a demo for entertainment and educational purposes.", article="
", examples=["IMG_3558.jpg"], interpretation="default", enable_queue=True, ).launch(share=True)