Martin Tomov commited on
Commit
677bda2
·
verified ·
1 Parent(s): 46f1350
Files changed (1) hide show
  1. app.py +7 -11
app.py CHANGED
@@ -215,7 +215,7 @@ def process_image(image, include_json, include_bboxes):
215
  with open(json_output_path, 'w') as json_file:
216
  json.dump(detections_json, json_file, indent=4)
217
  results.append(json.dumps(detections_json, separators=(',', ':')))
218
- else:
219
  results.append(None)
220
 
221
  return tuple(results)
@@ -242,18 +242,14 @@ with gr.Blocks() as demo:
242
  return (annotated_img, json_txt, crops)
243
  elif include_bboxes:
244
  annotated_img, *crops = results
245
- json_txt = None
246
- return (annotated_img, json_txt, crops)
247
  elif include_json:
248
- annotated_img, json_txt = results[:2]
249
- crops = []
250
- return (annotated_img, json_txt, crops)
251
  else:
252
- annotated_img = results[0]
253
- json_txt = None
254
- crops = []
255
- return (annotated_img, json_txt, crops)
256
 
257
  submit_button.click(update_outputs, [image_input, include_json, include_bboxes], [annotated_output, json_output, crops_output])
258
 
259
- demo.launch
 
215
  with open(json_output_path, 'w') as json_file:
216
  json.dump(detections_json, json_file, indent=4)
217
  results.append(json.dumps(detections_json, separators=(',', ':')))
218
+ elif not include_bboxes:
219
  results.append(None)
220
 
221
  return tuple(results)
 
242
  return (annotated_img, json_txt, crops)
243
  elif include_bboxes:
244
  annotated_img, *crops = results
245
+ return (annotated_img, None, crops)
 
246
  elif include_json:
247
+ annotated_img, json_txt = results
248
+ return (annotated_img, json_txt, [])
 
249
  else:
250
+ annotated_img, = results
251
+ return (annotated_img, None, [])
 
 
252
 
253
  submit_button.click(update_outputs, [image_input, include_json, include_bboxes], [annotated_output, json_output, crops_output])
254
 
255
+ demo.launch()