import gradio as gr from fastai.vision.all import * import skimage def is_cat(x): return x[0].isupper() learn = load_learner('model.pkl') labels = learn.dls.vocab categories = ('Dog', 'Cat') def predict(img): img = PILImage.create(img) img.thumbnail((192, 192)) pred,pred_idx,probs = learn.predict(img) return dict(zip(categories, map(float, probs))) examples = ['cat.jpeg', 'dog.jpeg',] title = "Cat vs Dog classifier" description = "Classification of dog and cat :)" article="
" gr.Interface(fn=predict, inputs="image", outputs="label",title=title,description=description,article=article,examples=examples).launch()