Spaces:
Build error
Build error
| 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() |