Spaces:
Sleeping
Sleeping
File size: 468 Bytes
ca4485e 9f1c73f 6d4f489 6259fb7 6d4f489 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from fastai.vision.all import *
import gradio as gr
learn = load_learner('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=(192, 192))
label = gr.outputs.Label()
examples = ['test0.jpg', 'test1.jpg', 'test2.jpg']
intf = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples=examples)
intf.launch(inline=False) |