onursavas commited on
Commit
4449c8f
·
1 Parent(s): 0f7947c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -21,17 +21,17 @@ def find_layout(image):
21
  result = table_engine(img)
22
  # save_structure_res(result, save_folder, os.path.basename("result").split('.')[0])
23
 
24
- final_text = []
25
  for line in result:
26
- line.pop('img')
27
- print(line)
28
- final_text.append(line["res"][0]["text"])
29
 
30
  # h, w, _ = img.shape
31
  # res = sorted_layout_boxes(result, w)
32
  # convert_info_docx(img, res, save_folder, os.path.basename("result").split('.')[0])
33
 
34
- return str(final_text)
35
 
36
  iface = gr.Interface(fn=find_layout, inputs=[gr.Image(type="pil")], outputs="text", examples=examples)
37
  iface.launch()
 
21
  result = table_engine(img)
22
  # save_structure_res(result, save_folder, os.path.basename("result").split('.')[0])
23
 
24
+ final_text = ""
25
  for line in result:
26
+ if "res" in line:
27
+ print(line)
28
+ final_text += line["res"][0]["text"]
29
 
30
  # h, w, _ = img.shape
31
  # res = sorted_layout_boxes(result, w)
32
  # convert_info_docx(img, res, save_folder, os.path.basename("result").split('.')[0])
33
 
34
+ return final_text
35
 
36
  iface = gr.Interface(fn=find_layout, inputs=[gr.Image(type="pil")], outputs="text", examples=examples)
37
  iface.launch()