CoolFace
Apppublic

ShyamPaul/mlmodeldeploy

sourceHugging Faceapache-2.0updated 4y agoView on Hugging Face
0likes
app.py14 linesDownload Raw Back to root
1import gradio as gr2from fastai.vision.all import *3def is_cat(x): return x[0].isupper()4learn = load_learner('model.pkl')5categories=('Dog','Cat')6def classify_image(img):7  pred,idx,probs=learn.predict(img)8  return dict(zip(categories,map(float,probs)))9 10image=gr.inputs.Image(shape=(192,192))11label=gr.outputs.Label()12examples=['dog.jpg','cat.jpg']13intf=gr.Interface(fn=classify_image,inputs=image,outputs=label,examples=examples)14intf.launch(inline=False)