Download scripts/r5_print/r5_print_schema.py from treoa/turkic-ocr-code: direct link, hf CLI and curl.
- Browser
- Download file 454 Bytes
-
https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_print/r5_print_schema.py
- Command line
-
hf download hf://treoa/turkic-ocr-code/scripts/r5_print/r5_print_schema.py
-
curl -L -o r5_print_schema.py https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_print/r5_print_schema.py
454 Bytes
| import sys | |
| import pyarrow.parquet as pq | |
| from huggingface_hub import HfFileSystem | |
| fs = HfFileSystem() | |
| p = sys.argv[1] | |
| with fs.open(p, "rb") as f: | |
| pf = pq.ParquetFile(f) | |
| print(pf.schema_arrow) | |
| print("row groups", pf.num_row_groups, "rows", pf.metadata.num_rows) | |
| tb = pf.read_row_group(0, columns=[n for n in pf.schema_arrow.names if n != "text"]) | |
| d = tb.slice(0, 2).to_pydict() | |
| for k, v in d.items(): | |
| print(k, str(v)[:200]) | |