CoolFace
Apppublic

OceanView99/orange

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
0likes
app.py25 linesDownload Raw Back to root
1#!/usr/bin/env python2 3import gradio as gr4 5from fastai.vision.all import *6def is_cat(x): return x[0].isupper()7 8learn=load_learner('model.pkl')9 10 11 12#|export13categories=('Dog','Cat')14def classify_image(img):15    pred,idx, probs=learn.predict(img)16    return dict(zip(categories, map(float, probs)))17 18 19#|export20image = gr.inputs.Image(shape=(192,192))21label=gr.outputs.Label()22examples=['dog.jpg','cat.jpeg','cat2.jpeg','some.jpg','some.jpeg']23intf=gr.Interface(fn=classify_image, inputs=image, outputs=label, examples = examples)24intf.launch(inline=False)25