Spaces:
Sleeping
Sleeping
File size: 696 Bytes
2d6cd88 321bc63 6665a29 2d6cd88 321bc63 6665a29 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | from fastai.vision.all import *
import skimage
import gradio as gr
learn = load_learner('export_pets.pkl') #this is a kinda dog detector it seems
labels = learn.dls.vocab
def predict(img):
img = PILImage.create(img)
pred,pred_idx,probs = learn.predict(img)
return {labels[i]: float(probs[i]) for i in range(len(labels))}
gr.Interface(fn=predict,
title="Pet Breed Classifier",
description="Pet breed classifier using Oxford Pets Database. Test for Gradio and HuggingFace",
inputs=gr.Image(width=512, height=512), #this is the proper syntax for images not the (shape=(xxx,xxx))
outputs=gr.Label(num_top_classes=3)).launch(share=True) |