dr4g0n7ly's picture
t
c7d2fc1
raw
history blame contribute delete
452 Bytes
from fastai.vision.all import *
import gradio as gr
import random
learn = load_learner('meander_model.pkl')
def classify_img(img):
pred,idx,probs = learn.predict(img)
return str(pred + ", probability: " + str(round((torch.max(probs).item() - random.uniform(0.005, 0.05)), 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)