CoolFace
Apppublic

uhlarlar/secondClassifier

sourceHugging Faceapache-2.0updated 4y agoView on Hugging Face
0likes
app.py24 linesDownload Raw Back to root
1 2from fastai.vision.all import *3import gradio as gr4 5learn = load_learner('bearModel.pkl')6 7categories = ("grizzly", "black", "teddy", "polar")8 9def classify_img(img):10    pred,idx,probs = learn.predict(img)11    return dict(zip(categories, map(float,probs)))12 13image = gr.inputs.Image(shape=(192,192))14label = gr.outputs.Label()15examples = ['bear_2.jpg','bear_4.jpg','bear_5.jpg','bear_6.jpg']16 17 18 19def greet(name):20    return "Hello " + name + "!!"21 22 23iface = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples=examples)24iface.launch(inline=False)