CoolFace
Apppublic

jreji/RestNet

sourceHugging Faceupdated 4y agoView on Hugging Face
1likes
app.py19 linesDownload Raw Back to root
1import gradio as gr2from fastai.vision.all import *3import skimage4 5learn = load_learner('export.pkl')6 7labels = learn.dls.vocab8def predict(img):9    img = PILImage.create(img)10    pred,pred_idx,probs = learn.predict(img)11    return {labels[i]: float(probs[i]) for i in range(len(labels))}12 13title = "Pet Breed Classifier"14description = "A pet breed classifier trained on the Oxford pet classifier dataset."15article="<p style='text-align: center'><a href='https://huggingface.co/spaces/jreji/RestNet/tree/main' target='_blank'>Codebase</a></p>"16interpretation='default'17enable_queue=True18 19gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,interpretation=interpretation,enable_queue=enable_queue).launch()