handbags-shoes / app.py
rama100's picture
Fix image dimensions
a2a7099 verified
import gradio as gr
from fastai.vision.all import *
# import timm
learn = load_learner("hs_classifier.pkl")
categories = "handbag", "shoe"
def classify_image(img):
_,_,probs = learn.predict(img)
return dict(
zip(categories, map(float, probs))
)
examples = ['handbag.jpg', 'shoes.png']
image = gr.Image(height=200,width=200)
label = gr.Label()
interface =gr.Interface(fn = classify_image,
inputs=image,
outputs=label,
examples=examples)
interface.launch(share=True)