dr4g0n7ly's picture
final
17d94d4
raw
history blame
405 Bytes
from fastai.vision.all import *
import gradio as gr
learn = load_learner('spiral_model.pkl')
def classify_img(img):
pred,idx,probs = learn.predict(img)
return str(pred + ", probability: " + str(round(torch.max(probs).item(), 4)) )
image = gr.inputs.Image(shape=(400, 400))
label = gr.outputs.Label()
intf = gr.Interface(fn=classify_img, inputs=image, outputs=label)
intf.launch(inline=False)