Spaces:
Running
on
Zero
Running
on
Zero
Martin Tomov
commited on
revert
Browse files
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 |
-
|
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 |
-
|
246 |
-
return (annotated_img, json_txt, crops)
|
247 |
elif include_json:
|
248 |
-
annotated_img, json_txt = results
|
249 |
-
|
250 |
-
return (annotated_img, json_txt, crops)
|
251 |
else:
|
252 |
-
annotated_img = results
|
253 |
-
|
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()
|