()
| 21 | |
| 22 | |
| 23 | def main(): |
| 24 | import argparse |
| 25 | parser = argparse.ArgumentParser(description="Run pipeline and merge XML (orchestration entry).") |
| 26 | parser.add_argument("-i", "--input", required=True, help="Input image path") |
| 27 | parser.add_argument("-o", "--output", default=None, help="Output directory (default: config)") |
| 28 | parser.add_argument("--no-text", action="store_true", help="Skip OCR/text step") |
| 29 | args = parser.parse_args() |
| 30 | |
| 31 | if not os.path.exists(args.input): |
| 32 | print(f"Error: file not found {args.input}") |
| 33 | sys.exit(1) |
| 34 | |
| 35 | config = load_config() |
| 36 | output_dir = args.output or config.get("paths", {}).get("output_dir", "./output") |
| 37 | os.makedirs(output_dir, exist_ok=True) |
| 38 | |
| 39 | pipeline = Pipeline(config) |
| 40 | result = pipeline.process_image( |
| 41 | args.input, |
| 42 | output_dir=output_dir, |
| 43 | with_refinement=False, |
| 44 | with_text=not args.no_text, |
| 45 | ) |
| 46 | if result: |
| 47 | print(f"Output: {result}") |
| 48 | else: |
| 49 | sys.exit(1) |
| 50 | |
| 51 | |
| 52 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected