Spaces:
Runtime error
Runtime error
File size: 1,175 Bytes
c4368ce 3e1f6f1 c4368ce 3e1f6f1 c4368ce 3e1f6f1 c4368ce 3e1f6f1 91b86ed c4368ce 91b86ed c4368ce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# 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)
|