File size: 542 Bytes
a4e7148
 
 
 
34c9d70
7c921d2
a4e7148
 
 
 
 
 
 
 
 
 
 
c323699
 
a4e7148
 
 
 
7c921d2
 
 
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
26
27
from fastai.vision.all import *
import gradio as gr



model = load_learner('tradiotional_clothing_recognition-v1.pkl')


categories = model.dls.vocab

def recognize_image(image):
    pred, idx, probs = model.predict(image)
    return dict(zip(categories, map(float, probs)))

image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label(num_top_classes=5)
examples = [
    'unknown-1.jpg',
    'unknown-2.jpg'

    ]

iface = gr.Interface(fn=recognize_image, inputs=image, outputs=label, examples=examples)
iface.launch(inline=False)