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 demo = gr.Interface( fn=predict, inputs=gr.Image(shape=(512, 512)), outputs=gr.Label(num_top_classes=3), title="Saving the silkies", description="A pigeon/silkie classifier. Created as a demo for entertainment and educational purposes.", article="
", examples=["IMG_3558.jpg"], interpretation="default", enable_queue=True, ) demo.queue(concurrency_count=2, max_size=15) demo.launch()