|
12 | 12 |
|
13 | 13 | output_dir = Path("outputs") |
14 | 14 | output_dir.mkdir(parents=True, exist_ok=True) |
15 | | -if __name__ == "__main__": |
16 | | - img_path = "tests/test_files/table.jpg" |
17 | | - table_rec = LinelessTableRecognition() |
18 | 15 |
|
19 | | - html, elasp, polygons, logic_points, ocr_res = table_rec(img_path) |
20 | | - print(f"cost: {elasp:.5f}") |
| 16 | +img_path = "tests/test_files/lineless_table_recognition.jpg" |
| 17 | +table_rec = LinelessTableRecognition() |
21 | 18 |
|
22 | | - complete_html = format_html(html) |
| 19 | +html, elasp, polygons, logic_points, ocr_res = table_rec(img_path) |
| 20 | +print(f"cost: {elasp:.5f}") |
23 | 21 |
|
24 | | - save_table_path = output_dir / "table.html" |
25 | | - with open(save_table_path, "w", encoding="utf-8") as file: |
26 | | - file.write(complete_html) |
| 22 | +complete_html = format_html(html) |
27 | 23 |
|
28 | | - plot_rec_box_with_logic_info( |
29 | | - img_path, f"{output_dir}/table_rec_box.jpg", logic_points, polygons |
30 | | - ) |
31 | | - plot_rec_box(img_path, f"{output_dir}/ocr_box.jpg", ocr_res) |
32 | | - print(f"The results has been saved under {output_dir}") |
| 24 | +save_table_path = output_dir / "table.html" |
| 25 | +with open(save_table_path, "w", encoding="utf-8") as file: |
| 26 | + file.write(complete_html) |
| 27 | + |
| 28 | +plot_rec_box_with_logic_info( |
| 29 | + img_path, f"{output_dir}/table_rec_box.jpg", logic_points, polygons |
| 30 | +) |
| 31 | +plot_rec_box(img_path, f"{output_dir}/ocr_box.jpg", ocr_res) |
| 32 | +print(f"The results has been saved under {output_dir}") |
0 commit comments