Datasets:
Download scripts/test_export_html.py from dinhanhx/ftu-VietFinTab: direct link, hf CLI and curl.
- Browser
- Download file 592 Bytes
-
https://huggingface.co/datasets/dinhanhx/ftu-VietFinTab/resolve/main/scripts/test_export_html.py
- Command line
-
hf download hf://datasets/dinhanhx/ftu-VietFinTab/scripts/test_export_html.py
-
curl -L -o test_export_html.py https://huggingface.co/datasets/dinhanhx/ftu-VietFinTab/resolve/main/scripts/test_export_html.py
592 Bytes
| # /// script | |
| # requires-python = ">=3.10" | |
| # dependencies = [] | |
| # /// | |
| from export_html import build_html | |
| rows = [(0, 0, 100, 10), (0, 10, 100, 20)] | |
| cols = [(0, 0, 50, 20), (50, 0, 100, 20)] | |
| ocr = [{"text": "A&B", "bbox": [0, 0, 40, 9]}, {"text": "x", "bbox": [60, 12, 70, 19]}, | |
| {"text": "y", "bbox": [5, 12, 15, 19]}] | |
| h = build_html(rows, cols, [(0, 0, 100, 10)], ocr) # first row merged | |
| assert '<tr><td colspan="2">A&B</td></tr>' in h, h | |
| assert "<tr><td>y</td><td>x</td></tr>" in h, h | |
| assert "<td" in build_html(rows, cols, [], []) # no text -> empty cells, no crash | |
| print("ok") | |