File size: 504 Bytes
1691a02
b22a0c6
1691a02
 
 
 
b22a0c6
 
 
 
 
 
 
 
 
 
 
 
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 *

def greet(name):
    return "Hello " + name + "!!"

learn = load_learner('condensed_model.pkl')

def classify_image(image):
    prediction, idx, probabilities = learn.predict(image)
    return dict(zip(learn.dls.vocab, map(float, probabilities)))

image = gr.inputs.Image(shape=(224, 224))
label = gr.outputs.Label(num_top_classes=3)

intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, capture_session=True)

intf.launch(inline=False)