Spaces:
Runtime error
Runtime error
# The A.M.A.Z.I.N.G B.E.A.R.D D.E.T.E.C.T.I.V.E ! ! ! | |
import gradio as gr | |
from fastai.vision.all import * | |
import skimage | |
learn = load_learner('export.pkl') | |
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))} | |
title = "The A.M.A.Z.I.N.G B.E.A.R.D D.E.T.E.C.T.I.V.E ! ! !" | |
description = "A Beard Detector created using a pretrained ResNet50 model fine tuned using fast.ai" | |
article="<p style='text-align: center'><a href='https://www.kaggle.com/code/mikemoloch/the-amazing-beard-detector' target='_blank'>Kaggle Notebook</a></p>" | |
examples = [ 'beard_00000111.jpg', 'beard_00000119.jpg', 'beard_00000129.jpg', 'beard_00000162.jpg', 'clean_00000115.jpg', 'clean_00000138.jpeg', 'clean_00000197.jpg' ] | |
interpretation='default' | |
enable_queue=True | |
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch() | |