Hayk Arutyunyan commited on
Commit ·
0695d15
1
Parent(s): 7b0cda0
Add run.py entrypoint
Browse files- configs/config.yaml +1 -2
- run.py +37 -0
configs/config.yaml
CHANGED
|
@@ -13,5 +13,4 @@ colors:
|
|
| 13 |
red: [[0, 150, 150], [10, 255, 255]]
|
| 14 |
|
| 15 |
export:
|
| 16 |
-
excel_filename: "ocr_results.xlsx"
|
| 17 |
-
>>>>>>> e710af8 (Update project structure, add pipeline and tests)
|
|
|
|
| 13 |
red: [[0, 150, 150], [10, 255, 255]]
|
| 14 |
|
| 15 |
export:
|
| 16 |
+
excel_filename: "ocr_results.xlsx"
|
|
|
run.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Entry point for running the mnemo OCR pipeline.
|
| 4 |
+
|
| 5 |
+
Usage:
|
| 6 |
+
python run.py
|
| 7 |
+
python run.py --config configs/config.yaml
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import argparse
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
|
| 13 |
+
from src.config_loader import load_config
|
| 14 |
+
from src.pipeline import process_all_images_to_excel
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def main():
|
| 18 |
+
parser = argparse.ArgumentParser(description="Run OCR pipeline.")
|
| 19 |
+
parser.add_argument(
|
| 20 |
+
"--config",
|
| 21 |
+
type=str,
|
| 22 |
+
default="configs/config.yaml",
|
| 23 |
+
help="Path to configuration YAML file",
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
args = parser.parse_args()
|
| 27 |
+
|
| 28 |
+
config_path = Path(args.config)
|
| 29 |
+
if not config_path.exists():
|
| 30 |
+
raise FileNotFoundError(f"Config file not found: {config_path}")
|
| 31 |
+
|
| 32 |
+
cfg = load_config(config_path)
|
| 33 |
+
process_all_images_to_excel(cfg)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
if __name__ == "__main__":
|
| 37 |
+
main()
|