Skip to content

Commit

Permalink
Update lineless_table_rec.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Joker1212 authored Sep 12, 2024
1 parent 35bf445 commit 11036f7
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions content/docs/install_usage/lineless_table_rec.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,32 @@ pip install lineless_table_rec


```python {linenos=table}
from lineless_table_rec import LinelessTableRecognition
import os

engine = LinelessTableRecognition()
from lineless_table_rec import LinelessTableRecognition
from lineless_table_rec.utils_table_recover import (
format_html,
plot_rec_box,
plot_rec_box_with_logic_info,
)

output_dir = "outputs"
img_path = "tests/test_files/lineless_table_recognition.jpg"
table_str, elapse = engine(img_path)
table_rec = LinelessTableRecognition()

html, elasp, polygons, logic_points, ocr_res = table_rec(img_path)
print(f"cost: {elasp:.5f}")

complete_html = format_html(html)
os.makedirs(os.path.dirname(f"{output_dir}/table.html"), exist_ok=True)

with open(f"{output_dir}/table.html", "w", encoding="utf-8") as file:
file.write(complete_html)

print(table_str)
print(elapse)
plot_rec_box_with_logic_info(
img_path, f"{output_dir}/table_rec_box.jpg", logic_points, polygons
)
plot_rec_box(img_path, f"{output_dir}/ocr_box.jpg", ocr_res)
```

{{% /tab %}}
Expand Down Expand Up @@ -156,4 +173,4 @@ $ lineless_table_rec -img tests/test_files/lineless_table_recognition.jpg
</html>
```

</details>
</details>

0 comments on commit 11036f7

Please sign in to comment.