tejasnavada
add examples
9040fd1
raw
history blame contribute delete
No virus
708 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()
examples = ['0.jpg', '1.jpg', '2.png', '3.jpg', '4.jpg', '5.jpeg', '6.png', '7.jpg', '8.jpeg', '9.jpg',]
iface = gr.Interface(fn=classify_img, inputs=inputs, outputs=label, examples=examples, title="Insert an image of any number 0-9")
iface.launch(inline=False)