CoolFace
Apppublic

bbb111bbb/deploy_test

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes
app.py24 linesDownload Raw Back to root
1from fastai.vision.all import *2import gradio as gr3 4def is_cat(x): return x[0].isupper()5 6learn = load_learner('model.pkl')7 8categories = ('Dog', 'Cat')9 10def classify_image(img):11    pred, pred_idx, probs = learn.predict(img.resize((192,192)))12    return dict(zip(categories, map(float, probs)))13 14 15def greet(name):16    return "Hello " + name + "!!"17 18demo = gr.Interface(19    fn=classify_image,20    inputs=gr.Image(type='pil'),21    outputs=gr.Label(),22    examples=['dog.jpg', 'cat.jpg', 'bird.jpg'],23)24demo.launch()