bird_cat_forest / app.py
jtjanaka's picture
Add .gitattributes and a new model.
b2c9725
raw
history blame contribute delete
362 Bytes
from fastbook import *
import gradio as gr
learn_inf = load_learner('bird_forest_cat_model.pkl')
labels = learn_inf.dls.vocab
def predict(img):
img = PILImage.create(img)
pred,pred_idx,probs = learn_inf.predict(img)
return {labels[i]: float(probs[i]) for i in range(len(labels))}
gr.Interface(fn=predict, inputs="image", outputs="label").launch()