Timmy1123/minimal
0
1 2__all__ = ['is_cat', 'learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']3 4# Cell5from fastai.vision.all import *6import gradio as gr7 8def is_cat(x): return x[0].isupper()9 10# Cell11learn = load_learner('model.pkl')12 13# Cell14categories = ('Dog', 'Cat')15 16def classify_image(img):17 pred,idx,probs = learn.predict(img)18 return dict(zip(categories, map(float,probs)))19 20# Cell21image = gr.inputs.Image(shape=(192, 192))22label = gr.outputs.Label()23 24intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)25intf.launch(inline=True)