# AUTOGENERATED! DO NOT EDIT! File to edit: ../methane-plume-classification-yes-or-no.ipynb. # %% auto 0 __all__ = ['temp', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image'] # %% ../methane-plume-classification-yes-or-no.ipynb 2 import warnings warnings.filterwarnings('ignore') # %% ../methane-plume-classification-yes-or-no.ipynb 3 import pathlib temp = pathlib.PosixPath pathlib.PosixPath = pathlib.WindowsPath # %% ../methane-plume-classification-yes-or-no.ipynb 4 import fastbook import pandas as pd import numpy as np import os from fastbook import * from fastai.vision.widgets import * import gradio as gr # %% ../methane-plume-classification-yes-or-no.ipynb 20 categories = ('No Plume', 'Plume') def classify_image(img): pred, idx, probs = learn.predict(img) return dict(zip(categories, map(float, probs))) # %% ../methane-plume-classification-yes-or-no.ipynb 22 image = gr.inputs.Image(shape = (152, 152)) label = gr.outputs.Label() examples = ['plume1.png', 'plume2.png', 'noplume1.png', 'noplume2.png'] intf = gr.Interface(fn = classify_image, inputs = image, outputs = label, examples = examples) intf.launch(inline = False)