Alex Strick van Linschoten commited on
Commit
404174f
1 Parent(s): 5c79297

fix aspect issues

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -121,10 +121,11 @@ def predict(pdf, confidence, generate_file):
121
  os.path.join(tmp_dir, filename_without_extension, image)
122
  ) as img:
123
  size = img.size
124
- if size[0] > size[1]:
125
- pdf.add_page("L")
 
126
  else:
127
- pdf.add_page("P")
128
  pred_dict = model_type.end2end_detect(
129
  img,
130
  valid_tfms,
 
121
  os.path.join(tmp_dir, filename_without_extension, image)
122
  ) as img:
123
  size = img.size
124
+ width, height = size
125
+ if width > height:
126
+ pdf.add_page((height, width))
127
  else:
128
+ pdf.add_page((width, height))
129
  pred_dict = model_type.end2end_detect(
130
  img,
131
  valid_tfms,