Nighty3912 commited on
Commit
16347be
·
verified ·
1 Parent(s): e3f6fc1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -47,11 +47,11 @@ class ReferenceBoxNotDetectedError(Exception):
47
  pass
48
 
49
  class BoundaryOverlapError(Exception):
50
- """Raised when the optional boundary dimensions are too small and overlap with the inner contours."""
51
  pass
52
 
53
  class TextOverlapError(Exception):
54
- """Raised when the text overlaps with the inner contours (with a margin of 0.75)."""
55
  pass
56
 
57
  # ---------------------
@@ -1106,9 +1106,9 @@ def add_rectangular_boundary(doc, polygons_inch, boundary_length, boundary_width
1106
  text_top = boundary_polygon.bounds[1] + 1
1107
  too_small = boundary_width_in < inner_width + 2 * clearance_side or boundary_length_in < inner_length + 2 * clearance_tb
1108
  if too_small:
1109
- raise BoundaryOverlapError("Error: The specified boundary dimensions are too small and overlap with the inner contours. Please provide larger values.")
1110
  if annotation_text.strip() and text_top > min_y - 0.75:
1111
- raise TextOverlapError("Error: The text is too close to the inner contours. Please increase boundary length.")
1112
  return boundary_polygon
1113
 
1114
  def draw_polygons_inch(polygons_inch, image_rgb, scaling_factor, image_height, color=(0,0,255), thickness=2):
 
47
  pass
48
 
49
  class BoundaryOverlapError(Exception):
50
+ """The specified boundary dimensions are too small and overlap with the inner contours.Please provide larger value for boundary length and width."""
51
  pass
52
 
53
  class TextOverlapError(Exception):
54
+ """Raised when the text overlaps with the inner contours (with a margin of 0.75).Please provide larger value for boundary length and width."""
55
  pass
56
 
57
  # ---------------------
 
1106
  text_top = boundary_polygon.bounds[1] + 1
1107
  too_small = boundary_width_in < inner_width + 2 * clearance_side or boundary_length_in < inner_length + 2 * clearance_tb
1108
  if too_small:
1109
+ raise BoundaryOverlapError("Error: The specified boundary dimensions are too small and overlap with the inner contours. Please provide larger value for boundary length and width.")
1110
  if annotation_text.strip() and text_top > min_y - 0.75:
1111
+ raise TextOverlapError("Error: The text is too close to the inner contours. Please provide larger value for boundary length and width.")
1112
  return boundary_polygon
1113
 
1114
  def draw_polygons_inch(polygons_inch, image_rgb, scaling_factor, image_height, color=(0,0,255), thickness=2):