File size: 499 Bytes
3f96d45
de04ff2
3f96d45
de04ff2
3f96d45
de04ff2
 
 
 
 
 
 
 
9c1b10d
de04ff2
 
9c1b10d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)