minimal / app.py
anglesplato's picture
Update app.py
f78f225 verified
raw
history blame contribute delete
511 Bytes
import gradio as gr
from fastai.vision.all import *
def is_cat(x):
return x[0].isupper()
categories = ('Dog', 'Cat')
learn = load_learner('model.pkl')
def classify_image(img):
pred , idx , probs = learn.predict(img)
return dict(zip(categories , map(float,probs)))
image = gr.Image()
label = gr.Label()
examples = ['dog.jpg', 'cat.jpg', 'dumo.jpg']
demo = gr.Interface(fn=classify_image, inputs=image, outputs= label)
demo.launch(inline = False)
m = learn.model
ps = list(m.parameters())
ps[1]