File size: 565 Bytes
a4e7148
 
 
 
34c9d70
a28a2e3
a4e7148
 
 
 
 
 
 
 
 
 
 
a28a2e3
 
 
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
28
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-6.jpg',
    'unknown-16.jpg',
    'unknown-18.jpg'

    ]

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