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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -15
app.py CHANGED
@@ -29,20 +29,6 @@ def unnormalize_box(bbox, width, height):
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)
@@ -78,7 +64,7 @@ def process_image_PaddleOCR(image,width,height):
78
  for bbox in line:
79
  words.append(bbox[1][0])
80
  scores.append(bbox[1][1])
81
- boxes.append(create_bounding_box1(bbox[0], width_scale, height_scale))
82
 
83
  output_image = draw_ocr(image, boxes, words, scores, font_path='coolvetica rg.otf')
84
  return words, boxes, scores, output_image
 
29
  height * (bbox[3] / 1000),
30
  ]
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  def imageconversion(pdffile):
33
  doc = fitz.open(pdffile)
34
  page = doc.load_page(0)
 
64
  for bbox in line:
65
  words.append(bbox[1][0])
66
  scores.append(bbox[1][1])
67
+ boxes.append(bbox[0])
68
 
69
  output_image = draw_ocr(image, boxes, words, scores, font_path='coolvetica rg.otf')
70
  return words, boxes, scores, output_image