SWHL commited on
Commit
4c6851c
1 Parent(s): 1286523

Fix gr.Inputs.Image type

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -10,8 +10,7 @@ import gradio as gr
10
  from ctrnet_infer import CTRNetInfer
11
 
12
 
13
- def inference(img):
14
- img_path = img.name
15
  img = cv2.imread(img_path)
16
  pred = ctrnet(img)
17
  pred = cv2.cvtColor(pred, cv2.COLOR_BGR2RGB)
@@ -29,10 +28,10 @@ examples = [['images/1.jpg'], ['images/2.jpg'], ['images/4.jpg']]
29
  gr.Interface(
30
  inference,
31
  inputs=[
32
- gr.inputs.Image(type='file', label='Input'),
33
  ],
34
  outputs=[
35
- gr.outputs.Image(type='file', label='Output_image'),
36
  ],
37
  title=title,
38
  description=description,
 
10
  from ctrnet_infer import CTRNetInfer
11
 
12
 
13
+ def inference(img_path):
 
14
  img = cv2.imread(img_path)
15
  pred = ctrnet(img)
16
  pred = cv2.cvtColor(pred, cv2.COLOR_BGR2RGB)
 
28
  gr.Interface(
29
  inference,
30
  inputs=[
31
+ gr.inputs.Image(type='filepath', label='Input'),
32
  ],
33
  outputs=[
34
+ gr.outputs.Image(type='filepath', label='Output_image'),
35
  ],
36
  title=title,
37
  description=description,