dongsheng commited on
Commit
86d1958
·
1 Parent(s): eeb3c37

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -29,13 +29,13 @@ def img2label(left, right):
29
  pred = pred.cpu().numpy().tolist()
30
 
31
  if len(pred) == 0 or (len(pred) == 1 and pred[0] == 0):
32
- return LABELS[0]
33
  res = ''
34
  for i in pred:
35
  if i == 0:
36
  continue
37
  res += ', ' + LABELS[i]
38
- return '目前的身体状态:' + res[2:]
39
 
40
 
41
  if __name__ == '__main__':
@@ -71,6 +71,6 @@ if __name__ == '__main__':
71
  # r = img2label(left_img_dir, right_img_dir)
72
  demo = gr.Interface(fn=img2label,
73
  inputs=[gr.inputs.Image(), gr.inputs.Image()],
74
- outputs="text",
75
  examples=examples, title=title, description=description)
76
  demo.launch()
 
29
  pred = pred.cpu().numpy().tolist()
30
 
31
  if len(pred) == 0 or (len(pred) == 1 and pred[0] == 0):
32
+ return res_dict, LABELS[0]
33
  res = ''
34
  for i in pred:
35
  if i == 0:
36
  continue
37
  res += ', ' + LABELS[i]
38
+ return res_dict, '目前的身体状态:' + res[2:]
39
 
40
 
41
  if __name__ == '__main__':
 
71
  # r = img2label(left_img_dir, right_img_dir)
72
  demo = gr.Interface(fn=img2label,
73
  inputs=[gr.inputs.Image(), gr.inputs.Image()],
74
+ outputs=["label", "text"],
75
  examples=examples, title=title, description=description)
76
  demo.launch()