Spaces:
Sleeping
Sleeping
File size: 557 Bytes
abab0cd c2d818a abab0cd 3b4e1c8 a2a7099 abab0cd 3b4e1c8 abab0cd 3b4e1c8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
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) |