from fastai.vision.all import * | |
import gradio as gr | |
def is_cat(x): return x[0].isupper() | |
categories = ('Dog', 'Cat') | |
learn = load_learner('model.pkl') | |
def predict(img): | |
pred,pred_idx,probs = learn.predict(img) | |
return dict(zip(categories,map(float,probs))) | |
input = gr.inputs.Image(shape=(192, 192)) | |
output = gr.outputs.Label() | |
gr.Interface(fn=predict, inputs=input, outputs=output).launch(share=False) | |