File tree Expand file tree Collapse file tree 4 files changed +49
-49
lines changed
Expand file tree Collapse file tree 4 files changed +49
-49
lines changed Original file line number Diff line number Diff line change 1616#
1717
1818# pipeline configuration
19- build : " batch-ocr-pipeline-20254007"
20- run_name : " run_ocr"
19+ build : batch-ocr-pipeline-20254007
20+ run_name : run_ocr
2121
2222# environment configuration
2323settings :
2424 docker :
25- requirements :
26- - requirements.txt
25+ requirements : requirements.txt
2726 required_integrations :
2827 - aws
2928 - s3
30- python_package_installer : " uv "
29+ python_package_installer : uv
3130 environment :
3231 OPENAI_API_KEY : ${{ env.OPENAI_API_KEY }}
3332 MISTRAL_API_KEY : ${{ env.MISTRAL_API_KEY }}
@@ -42,44 +41,44 @@ enable_step_logs: True
4241steps :
4342 load_images :
4443 parameters :
45- image_folder : " ./assets/samples_for_ocr"
44+ image_folder : ./assets/samples_for_ocr
4645 image_paths : []
4746 enable_cache : False
4847
4948 run_ocr :
5049 parameters :
5150 custom_prompt : null
5251 models : # can be model names or shorthands
53- - " pixtral"
54- - " llava-phi3 "
55- - " gpt4o "
56- - " granite3.2-vision "
57- - " gemma3 "
52+ - pixtral
53+ - gemma3
54+ - llava-phi3
55+ - gpt4o
56+ - granite
5857 enable_cache : False
5958
6059# vision models configuration
6160models_registry :
62- - name : " mistral/pixtral-12b-2409"
63- shorthand : " pixtral"
64- ocr_processor : " litellm"
65- provider : " mistral"
61+ - name : mistral/pixtral-12b-2409
62+ shorthand : pixtral
63+ ocr_processor : litellm
64+ provider : mistral
6665
67- - name : " gpt-4o-mini"
68- shorthand : " gpt4o"
69- ocr_processor : " openai"
66+ - name : gpt-4o-mini
67+ shorthand : gpt4o
68+ ocr_processor : openai
7069
71- - name : " gemma3:27b"
72- shorthand : " gemma3"
73- ocr_processor : " ollama"
70+ - name : gemma3:27b
71+ shorthand : gemma3
72+ ocr_processor : ollama
7473
75- - name : " llava:34b"
76- shorthand : " llava34b"
77- ocr_processor : " ollama"
74+ - name : llava:34b
75+ shorthand : llava34b
76+ ocr_processor : ollama
7877
79- - name : " llava-phi3"
80- shorthand : " llava-phi3"
81- ocr_processor : " ollama"
78+ - name : llava-phi3
79+ shorthand : llava-phi3
80+ ocr_processor : ollama
8281
83- - name : " granite3.2-vision"
84- shorthand : " granite"
85- ocr_processor : " ollama"
82+ - name : granite3.2-vision
83+ shorthand : granite
84+ ocr_processor : ollama
Original file line number Diff line number Diff line change 1616#
1717
1818# pipeline configuration
19- build : " ocr-evaluation-pipeline-20254007"
20- run_name : " ocr_evaluation_run"
19+ build : ocr-evaluation-pipeline-20254007
20+ run_name : ocr_evaluation_run
2121
2222# environment configuration
2323settings :
2424 docker :
25- requirements :
26- - requirements.txt
25+ requirements : requirements.txt
2726 required_integrations :
2827 - aws
2928 - s3
30- python_package_installer : " uv "
29+ python_package_installer : uv
3130 environment :
3231 OPENAI_API_KEY : ${{ env.OPENAI_API_KEY }}
3332 MISTRAL_API_KEY : ${{ env.MISTRAL_API_KEY }}
@@ -43,11 +42,14 @@ steps:
4342 load_ocr_results : # loads OCR results from batch pipeline runs
4443 enable_cache : False
4544 parameters :
46- artifact_name : " ocr_results"
45+ artifact_name : ocr_results
4746 version : null
4847
4948 load_ground_truth_texts :
5049 enable_cache : False
5150 parameters :
52- ground_truth_folder : " ground_truth_texts"
51+ ground_truth_folder : ground_truth_texts
5352 ground_truth_files : []
53+
54+ evaluate_models :
55+ enable_cache : False
Original file line number Diff line number Diff line change 3535docker_settings = DockerSettings (
3636 required_integrations = ["s3" , "aws" ],
3737 python_package_installer = "uv" ,
38+ requirements = "requirements.txt" ,
3839 environment = {
3940 "OPENAI_API_KEY" : os .getenv ("OPENAI_API_KEY" ),
4041 "MISTRAL_API_KEY" : os .getenv ("MISTRAL_API_KEY" ),
Original file line number Diff line number Diff line change @@ -114,17 +114,15 @@ def run_ocr(
114114 combined_results = pl .concat (list (model_dfs .values ()), how = "diagonal" )
115115
116116 # Generate HTML visualization
117- try :
118- html_visualization = create_ocr_batch_visualization (combined_results )
119- log_metadata (
120- metadata = {
121- "ocr_results_artifact_name" : "ocr_results" ,
122- "ocr_results_artifact_type" : "polars.DataFrame" ,
123- "ocr_batch_visualization_artifact_name" : "ocr_batch_visualization" ,
124- "ocr_batch_visualization_artifact_type" : "zenml.types.HTMLString" ,
125- },
126- )
127- except Exception as e :
128- logger .error (f"Error generating visualization: { e } " )
117+ html_visualization = create_ocr_batch_visualization (combined_results )
118+
119+ log_metadata (
120+ metadata = {
121+ "ocr_results_artifact_name" : "ocr_results" ,
122+ "ocr_results_artifact_type" : "polars.DataFrame" ,
123+ "ocr_batch_visualization_artifact_name" : "ocr_batch_visualization" ,
124+ "ocr_batch_visualization_artifact_type" : "zenml.types.HTMLString" ,
125+ },
126+ )
129127
130128 return combined_results , html_visualization
You can’t perform that action at this time.
0 commit comments