File size: 497 Bytes
4464278
 
 
 
 
 
 
 
 
 
 
 
cf22ef1
 
839fc47
 
2fac5ae
839fc47
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from fastai.vision.all import *

learn = load_learner('export.pkl')

def predict_image(img):
    prediction, _, _ = learn.predict(img)
    return prediction


# UI huggface

# image = gr.Image(shape=(192, 192))
# label = gr.Label()
#intrfce = gr.Interface(fn=predict_image, inputs=image, outputs=label)

intrfce = gr.Interface(fn=predict_image,
             inputs=gr.Image(type="pil"),
             outputs=gr.Label(num_top_classes=3)).launch()

# intrfce.launch(inline=False)