gvlachos's picture
updating link to blog post
af22995
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="<p style='text-align: center'><a href='https://blog.epinoia.com.au/2023/06/29/saving-the-silkies/' target='_blank'>Blog post related to this model</a></p>",
examples=["IMG_3558.jpg"],
interpretation="default",
enable_queue=True,
)
demo.queue(concurrency_count=2, max_size=15)
demo.launch()