JaMe76 commited on
Commit
49116ab
1 Parent(s): de19a8b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -144,12 +144,12 @@ def prepare_output(dp, add_table, add_ocr):
144
  out = dp.as_dict()
145
  out.pop("_image")
146
 
147
- layout_items = dp.items
148
  if add_ocr:
149
  layout_items.sort(key=lambda x: x.reading_order)
150
  layout_items_str = ""
151
  for item in layout_items:
152
- layout_items_str += f"\n {item.layout_type}: {item.text}"
153
  if add_table:
154
  html_list = [table.html for table in dp.tables]
155
  if html_list:
@@ -177,7 +177,7 @@ def analyze_image(img, pdf, attributes):
177
  df = DataFromList(lst=[image])
178
  df = analyzer.analyze(dataset_dataflow=df)
179
  elif pdf:
180
- df = analyzer.analyze(path=pdf.name, max_datapoints=3, output="image")
181
  else:
182
  raise ValueError
183
 
 
144
  out = dp.as_dict()
145
  out.pop("_image")
146
 
147
+ layout_items = dp.layouts
148
  if add_ocr:
149
  layout_items.sort(key=lambda x: x.reading_order)
150
  layout_items_str = ""
151
  for item in layout_items:
152
+ layout_items_str += f"\n {item.category_name}: {item.text}"
153
  if add_table:
154
  html_list = [table.html for table in dp.tables]
155
  if html_list:
 
177
  df = DataFromList(lst=[image])
178
  df = analyzer.analyze(dataset_dataflow=df)
179
  elif pdf:
180
+ df = analyzer.analyze(path=pdf.name, max_datapoints=3)
181
  else:
182
  raise ValueError
183