atatavana commited on
Commit
d059fc3
·
1 Parent(s): ec586c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -29,6 +29,20 @@ def unnormalize_box(bbox, width, height):
29
  height * (bbox[3] / 1000),
30
  ]
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  def imageconversion(pdffile):
33
  doc = fitz.open(pdffile)
34
  page = doc.load_page(0)
 
29
  height * (bbox[3] / 1000),
30
  ]
31
 
32
+ def create_bounding_box1(bbox_data, width_scale: float, height_scale: float):
33
+ xs = []
34
+ ys = []
35
+ for x, y in bbox_data:
36
+ xs.append(x)
37
+ ys.append(y)
38
+
39
+ left = int(max(0, min(xs) * width_scale))
40
+ top = int(max(0, min(ys) * height_scale))
41
+ right = int(min(1000, max(xs) * width_scale))
42
+ bottom = int(min(1000, max(ys) * height_scale))
43
+
44
+ return [left, top, right, bottom]
45
+
46
  def imageconversion(pdffile):
47
  doc = fitz.open(pdffile)
48
  page = doc.load_page(0)