PawarV
update app.py to our application code
0f21786
raw
history blame
510 Bytes
from fastai.vision.all import *
import gradio as gr
# determines if it's a cat from first letter
def is_cat(x): return x[0].isupper()
# load the model
learn = load_learner('model.pkl')
categories = ('Dog', 'Cat')
def predict(img):
pred,pred_idx,probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
# show it in a gradio interface
examples = [ 'cat1.png', 'dog1.png', 'python1.png']
gr.Interface(fn=predict, inputs=gr.Image(), outputs=gr.Label(), examples=examples).launch()