File size: 482 Bytes
d41d35d
1996a2f
 
e8ade96
 
 
 
d41d35d
1996a2f
d41d35d
1996a2f
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from fastai.vision.all import *
import numpy as np
import pathlib

plt = platform.system()
if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath

learn = load_learner('dense_model.pkl')

def classify_image(img):
    img = np.array(img)
    pred, idx, probs = learn.predict(img)
    return pred

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

intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
intf.launch(inline=False)