
    9i-                     l    S SK Jr  SSK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)    )custom_type   )add_simple_inference_argsget_subcommand_argsperform_simple_inference   )PaddleXPipelineWrapperPipelineCLISubcommandExecutor)create_config_from_structurec                   d   ^  \ rS rSr   S	U 4S jjr\S 5       rS rS r\	S 5       r
S rSrU =r$ )
DocUnderstanding   c                 <   > UUUS.U l         [        TU ]  " S0 UD6  g )N)doc_understanding_model_namedoc_understanding_model_dirdoc_understanding_batch_size )_paramssuper__init__)selfr   r   r   kwargs	__class__s        f/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/paddleocr/_pipelines/doc_understanding.pyr   DocUnderstanding.__init__   s*     -I+F,H

 	"6"    c                     gNdoc_understandingr   r   s    r   _paddlex_pipeline_name'DocUnderstanding._paddlex_pipeline_name*       "r   c                 <    U R                   R                  " U40 UD6$ N)paddlex_pipelinepredictr   inputr   s      r   predict_iterDocUnderstanding.predict_iter.   s    $$,,U=f==r   c                 :    [        U R                  " U40 UD65      $ r%   )listr*   r(   s      r   r'   DocUnderstanding.predict1   s    
 D%%e6v677r   c                     [        5       $ r%   )%DocUnderstandingCLISubcommandExecutor)clss    r   get_cli_subcommand_executor,DocUnderstanding.get_cli_subcommand_executor8   s    466r   c                 r    U R                   S   U R                   S   U R                   S   S.n[        U5      $ )Nr   r   r   )z&SubModules.DocUnderstanding.model_namez%SubModules.DocUnderstanding.model_dirz&SubModules.DocUnderstanding.batch_size)r   r   )r   	STRUCTUREs     r   _get_paddlex_config_overrides.DocUnderstanding._get_paddlex_config_overrides<   sG    6:ll.7 6:\\-6 7;ll.7

	 ,I66r   )r   )NNN)__name__
__module____qualname____firstlineno__r   propertyr!   r*   r'   classmethodr2   r6   __static_attributes____classcell__)r   s   @r   r   r      sO     &*$(%)	# # #>8 7 77 7r   r   c                   L    \ rS rSr\" \" \5      5      r\S 5       r	S r
S rSrg)r0   K   c                     gr   r   r    s    r   subparser_name4DocUnderstandingCLISubcommandExecutor.subparser_nameN   r#   r   c                     [        USS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        S	S9  g )
NzInput dict, e.g. `{"image": "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/medal_table.png", "query": "Recognize this table"}`.)
input_helpz--doc_understanding_model_namez)Name of the document understanding model.)typehelpz--doc_understanding_model_dirz3Path to the document understanding model directory.z--doc_understanding_batch_sizez0Batch size for the document understanding model.)r   add_argumentstr)r   	subparsers     r   _update_subparser7DocUnderstandingCLISubcommandExecutor._update_subparserR   sm    ! n	

 	,< 	 	

 	+F 	 	

 	,C 	 	
r   c                 h    [        U5      nU R                  US   5      US'   [        [        U5        g )Nr)   )r   input_validatorr   r   )r   argsparamss      r   execute_with_args7DocUnderstandingCLISubcommandExecutor.execute_with_argsh   s/    $T*..vg?w !16:r   r   N)r8   r9   r:   r;   staticmethodr   dictrO   r<   rC   rL   rR   r>   r   r   r   r0   r0   K   s-    ";t#45O# #
,;r   r0   N) paddlex.utils.pipeline_argumentsr   
_utils.clir   r   r   baser	   r
   utilsr   r   r0   r   r   r   <module>rZ      s8    9 
 H /.7- .7b ;,I  ;r   