File size: 422 Bytes
880a86b d6771bc 880a86b d6771bc 255aa74 880a86b 255aa74 880a86b 255aa74 880a86b 255aa74 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from fastai.vision.all import *
import gradio as gr
def is_cat(x): return x[0].isupper()
categories = ('Dog', 'Cat')
learn = load_learner('model.pkl')
def predict(img):
pred,pred_idx,probs = learn.predict(img)
return dict(zip(categories,map(float,probs)))
input = gr.inputs.Image(shape=(192, 192))
output = gr.outputs.Label()
gr.Interface(fn=predict, inputs=input, outputs=output).launch(share=False)
|