28 lines
866 B
Python
28 lines
866 B
Python
import argparse
|
|
|
|
from table_parsing.table_parsig import annotate_tables_in_pdf
|
|
from box_detection.box_detection import annotate_boxes_in_pdf
|
|
from layout_detection.layout_detection import annotate_layout_in_pdf
|
|
|
|
|
|
def parse_args():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("pdf_path")
|
|
parser.add_argument("page_index", type=int)
|
|
parser.add_argument("--type", choices=["table", "redaction", "layout"], default="table")
|
|
|
|
args = parser.parse_args()
|
|
|
|
return args
|
|
|
|
|
|
if __name__ == "__main__":
|
|
args = parse_args()
|
|
if args.type == "table":
|
|
annotate_tables_in_pdf(args.pdf_path, page_index=args.page_index)
|
|
elif args.type == "redaction":
|
|
annotate_boxes_in_pdf(args.pdf_path, page_index=args.page_index)
|
|
elif args.type == "layout":
|
|
annotate_layout_in_pdf(args.pdf_path, page_index=args.page_index)
|
|
|