Martin Tomov commited on
Commit
9eff9e4
1 Parent(s): ba1d3f9

with gr.Blocks() as demo: with gr.Row():

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -86,7 +86,7 @@ def get_boxes(detection_results: List[DetectionResult]) -> List[List[List[float]
86
 
87
  def mask_to_polygon(mask: np.ndarray) -> np.ndarray:
88
  contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
89
- if len(contours) == 0:
90
  return np.array([])
91
  largest_contour = max(contours, key=cv2.contourArea)
92
  return largest_contour
@@ -231,7 +231,7 @@ with gr.Blocks() as demo:
231
 
232
  annotated_output = gr.Image(type="numpy")
233
  json_output = gr.Textbox()
234
- crops_output = gr.Gallery(label="Cropped Bounding Boxes").style(grid=[2], height="auto")
235
 
236
  def update_outputs(image, include_json, include_bboxes):
237
  results = process_image(image, include_json, include_bboxes)
 
86
 
87
  def mask_to_polygon(mask: np.ndarray) -> np.ndarray:
88
  contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
89
+ if len(contours) is 0:
90
  return np.array([])
91
  largest_contour = max(contours, key=cv2.contourArea)
92
  return largest_contour
 
231
 
232
  annotated_output = gr.Image(type="numpy")
233
  json_output = gr.Textbox()
234
+ crops_output = gr.Gallery(label="Cropped Bounding Boxes")
235
 
236
  def update_outputs(image, include_json, include_bboxes):
237
  results = process_image(image, include_json, include_bboxes)