tejasnavada
fix windowsPath
0ebf6e8
raw
history blame
No virus
541 Bytes
from fastai.vision.all import *
import gradio as gr
import pathlib
plt = platform.system()
if plt == 'Windows': pathlib.WindowsPath = pathlib.PosixPath
learn = load_learner('number_100.pkl')
categories = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
def classify_img(img):
pred,idx,probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
inputs = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
iface = gr.Interface(fn=classify_img, inputs=inputs, outputs=label)
iface.launch(inline=False)