29 lines
492 B
Python
29 lines
492 B
Python
import argparse
|
|
import json
|
|
|
|
from image_prediction.default_objects import load_pipeline
|
|
|
|
|
|
def parse_args():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("pdf")
|
|
|
|
args = parser.parse_args()
|
|
|
|
return args
|
|
|
|
|
|
def main(args):
|
|
pipeline = load_pipeline()
|
|
|
|
with open(args.pdf, "rb") as f:
|
|
predictions = pipeline(f.read())
|
|
|
|
for prd in predictions:
|
|
print(json.dumps(prd, indent=1))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
args = parse_args()
|
|
main(args)
|