# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb. # %% auto 0 __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_jeans', 'classify_images'] # %% app.ipynb 3 from fastai.vision.all import * import gradio as gr def is_jeans(x): return x[0].isupper() learn = load_learner('export.pkl') categories = ('Jeans', 'Sofa', 'Tshirt', 'Tv') def classify_images(img): pred, idx, probs = learn.predict(img) return dict(zip(categories, map(float, probs))) # Create an Image component with the desired size image = gr.Image(image_mode="file", size=(192, 192)) label = gr.Label() examples = ['jeans.jpeg', 'sofa.jpeg', 'tshirt.jpg', 'tv.jpeg'] intf = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=examples) intf.launch(inline=False)