Spaces:
Build error
Build error
File size: 753 Bytes
8a61958 558b57b 8a61958 558b57b 8a61958 cff48d2 8a61958 cff48d2 8a61958 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | from fastai.vision.all import load_learner
from huggingface_hub import hf_hub_download
import gradio as gr
#downlaod model
model_path = hf_hub_download(repo_id="d-fuentep/Outfit-classifier", filename="model.pkl")
learn = load_learner(model_path)
#obtain prediction function
def predict(image):
pred, _, probs = learn.predict(image)
return {learn.dls.vocab[i]: float(probs[i]) for i in range(len(probs))}
title = "Outfit classifier"
description = "Are you ready for that dinner? I'll tell you whether your outfit is formal or streetwear (do not take me seriously) "
examples = ['formal', 'streetwear']
#interface
demo = gr.Interface(fn=predict,inputs="image", outputs="label",title=title,description=description,examples=examples)
demo.launch() |