
    }-ji                     r    d dl mZmZmZmZ ddlmZmZ ddlm	Z	  G d de          Z
 G d de          Zd	S )
   )add_simple_inference_argsget_subcommand_argsperform_simple_inferencestr2bool   )PaddleXPipelineWrapperPipelineCLISubcommandExecutor)create_config_from_structurec                   z     e Zd Z	 	 	 	 	 	 d	 fd	Zed             ZddddZddddZed             Z	d Z
 xZS )
DocPreprocessorNc                 V    ||||||d| _          t                      j        di | d S )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/banglarbhumi/venv/lib/python3.11/site-packages/paddleocr/_pipelines/doc_preprocessor.pyr   zDocPreprocessor.__init__   sK     4W2T(@'>,H!2
 
 	""6"""""    c                     dS Ndoc_preprocessorr   r   s    r   _paddlex_pipeline_namez&DocPreprocessor._paddlex_pipeline_name/       !!r   r   r   c                <    | j                             |||          S Nr#   )paddlex_pipelinepredictr   inputr   r   s       r   predict_iterzDocPreprocessor.predict_iter3   s-     $,,)E/ - 
 
 	
r   c                L    t          |                     |||                    S r%   )listr*   r(   s       r   r'   zDocPreprocessor.predict@   s7     -I"3   
 
 	
r   c                     t                      S N)$DocPreprocessorCLISubcommandExecutor)clss    r   get_cli_subcommand_executorz+DocPreprocessor.get_cli_subcommand_executorO   s    3555r   c                     | j         d         | j         d         | j         d         | j         d         | j         d         | j         d         d}t          |          S )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_overridesz-DocPreprocessor._get_paddlex_config_overridesS   su    <@L5= <@<4< 37,*3 26)2 -1L.- "&.A!B!
 
	$ ,I666r   )NNNNNN)__name__
__module____qualname__r   propertyr!   r*   r'   classmethodr1   r4   __classcell__)r   s   @r   r   r      s         -1+/!% $%)# # # # # #* " " X" &*
 
 
 
 
" &*
 
 
 
 
 6 6 [67 7 7 7 7 7 7r   r   c                   0    e Zd Zed             Zd Zd ZdS )r/   c                     dS r   r   r    s    r   subparser_namez3DocPreprocessorCLISubcommandExecutor.subparser_namej   r"   r   c                    t          |           |                    dt          d           |                    dt          d           |                    dt          d           |                    dt          d	           |                    d
t          d           |                    dt          d           d S )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_subparserz6DocPreprocessorCLISubcommandExecutor._update_subparsern   s   !),,,3O 	 	
 	
 	

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

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

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

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

 	!7 	 	
 	
 	
 	
 	
r   c                 N    t          |          }t          t          |           d S r.   )r   r   r   )r   argsparamss      r   execute_with_argsz6DocPreprocessorCLISubcommandExecutor.execute_with_args   s%    $T** &99999r   N)r5   r6   r7   r8   r=   rD   rH   r   r   r   r/   r/   i   sL        " " X" 
  
  
D: : : : :r   r/   N)
_utils.clir   r   r   r   baser   r	   utilsr
   r   r/   r   r   r   <module>rL      s               H G G G G G G G / / / / / /M7 M7 M7 M7 M7, M7 M7 M7`*: *: *: *: *:+H *: *: *: *: *:r   