contrail_or_not / app.py
thomaswarford's picture
Add sky.png example image.
9c1b10d
raw
history blame contribute delete
499 Bytes
import gradio as gr
from fastai.vision.all import *
learn = load_learner("model.pkl")
categories = ("contrail", "no contrail")
def classify_image(image):
category, idx, probabilities = learn.predict(image)
return dict(zip(categories, map(float, probabilities)))
image = gr.Image(shape=(400, 400))
label = gr.outputs.Label()
examples = ["contrail.png", "sky.png"]
interface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
interface.launch(inline=False)