# AUTOGENERATED! DO NOT EDIT! File to edit: HUC4Web.ipynb. # %% auto 0 __all__ = ['plt', 'learner', 'categories', 'image', 'label', 'examples', 'intf', 'classify_img'] # %% HUC4Web.ipynb 1 from fastai.vision.all import * import gradio as gr # %% HUC4Web.ipynb 2 import pathlib plt = platform.system() if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath # %% HUC4Web.ipynb 5 learner = load_learner('./export.pkl') # %% HUC4Web.ipynb 7 categories = 'happy','unhappy' def classify_img(img): pred,idx,probs = learner.predict(img) return dict(zip(categories,map(float,probs))) # %% HUC4Web.ipynb 9 image = gr.inputs. Image (shape= (192, 192)) label = gr.outputs. Label () examples = ['unhappy.jpg','happy.jpg'] intf = gr. Interface(fn=classify_img, inputs=image, outputs=label, examples=examples) intf.launch(inline=False)