File size: 502 Bytes
9452a82
87c3d81
c2fd87e
87c3d81
c2fd87e
 
87c3d81
c2fd87e
87c3d81
c2fd87e
 
 
 
577532a
c2fd87e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from mmdet.apis import init_detector, inference_detector
import mmcv
import gradio as gr

config_file = 'config/fashionformer_fashionpedia.py'
checkpoint_file = 'checkpoints/fashionformer.pth'

model = init_detector(config_file, checkpoint_file, device='cpu')

def predict(img):
    result = inference_detector(model, img)
    model.show_result(img, result, out_file='result.jpg', show=False)
    return 'result.jpg'

gr.Interface(fn=predict, inputs=gr.Image(type="filepath"), outputs="image").launch()