
    9ii                     d    S SK JrJrJrJr  SSKJrJr  SSKJ	r	   " S S\5      r
 " S S\5      rg	)
   )add_simple_inference_argsget_subcommand_argsperform_simple_inferencestr2bool   )PaddleXPipelineWrapperPipelineCLISubcommandExecutor)create_config_from_structurec                   ~   ^  \ rS rSr      SU 4S jjr\S 5       rSSS.S jrSSS.S jr\	S 5       r
S	 rS
rU =r$ )DocPreprocessor   Nc                 B   > UUUUUUS.U l         [        TU ]  " S0 UD6  g )N)#doc_orientation_classify_model_name"doc_orientation_classify_model_dirdoc_unwarping_model_namedoc_unwarping_model_diruse_doc_orientation_classifyuse_doc_unwarping )_paramssuper__init__)	selfr   r   r   r   r   r   kwargs	__class__s	           e/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/paddleocr/_pipelines/doc_preprocessor.pyr   DocPreprocessor.__init__   s3     4W2T(@'>,H!2
 	"6"    c                     gNdoc_preprocessorr   r   s    r   _paddlex_pipeline_name&DocPreprocessor._paddlex_pipeline_name/       !r   r   r   c                8    U R                   R                  UUUS9$ Nr&   )paddlex_pipelinepredictr   inputr   r   s       r   predict_iterDocPreprocessor.predict_iter3   s+     $$,,)E/ - 
 	
r   c                6    [        U R                  UUUS95      $ r(   )listr-   r+   s       r   r*   DocPreprocessor.predict@   s-     -I"3  
 	
r   c                     [        5       $ N)$DocPreprocessorCLISubcommandExecutor)clss    r   get_cli_subcommand_executor+DocPreprocessor.get_cli_subcommand_executorO   s    355r   c                     U R                   S   U R                   S   U R                   S   U R                   S   U R                   S   U R                   S   S.n[        U5      $ )Nr   r   r   r   r   r   )z,SubModules.DocOrientationClassify.model_namez+SubModules.DocOrientationClassify.model_dirz"SubModules.DocUnwarping.model_namez!SubModules.DocUnwarping.model_dirr   r   )r   r
   )r   	STRUCTUREs     r   _get_paddlex_config_overrides-DocPreprocessor._get_paddlex_config_overridesS   sy    <@LL5= <@<<4< 37,,*3 26)2 -1LL.- "&.A!B!
	$ ,I66r   )r   )NNNNNN)__name__
__module____qualname____firstlineno__r   propertyr#   r-   r*   classmethodr6   r:   __static_attributes____classcell__)r   s   @r   r   r      sh     -1+/!% $%)#* " " &*
" &*
 6 67 7r   r   c                   0    \ rS rSr\S 5       rS rS rSrg)r4   i   c                     gr    r   r"   s    r   subparser_name3DocPreprocessorCLISubcommandExecutor.subparser_namej   r%   r   c                    [        U5        UR                  S[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        S	S9  UR                  S
[        SS9  UR                  S[        SS9  g )Nz%--doc_orientation_classify_model_namez<Name of the document image orientation classification model.)typehelpz$--doc_orientation_classify_model_dirzFPath to the document image orientation classification model directory.z--doc_unwarping_model_namez+Name of the document image unwarping model.z--doc_unwarping_model_dirz5Path to the document image unwarping model directory.z--use_doc_orientation_classifyz9Whether to use document image orientation classification.z--use_doc_unwarpingz$Whether to use text image unwarping.)r   add_argumentstrr   )r   	subparsers     r   _update_subparser6DocPreprocessorCLISubcommandExecutor._update_subparsern   s    !),3O 	 	

 	2Y 	 	

 	(> 	 	

 	'H 	 	

 	,L 	 	

 	!7 	 	
r   c                 :    [        U5      n[        [        U5        g r3   )r   r   r   )r   argsparamss      r   execute_with_args6DocPreprocessorCLISubcommandExecutor.execute_with_args   s    $T* &9r   r   N)	r<   r=   r>   r?   r@   rG   rO   rT   rB   r   r   r   r4   r4   i   s    " " 
D:r   r4   N)
_utils.clir   r   r   r   baser   r	   utilsr
   r   r4   r   r   r   <module>rY      s5     H /M7, M7`*:+H *:r   