
    }-j-                     z    d dl mZ ddl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 )    )custom_type   )add_simple_inference_argsget_subcommand_argsperform_simple_inference   )PaddleXPipelineWrapperPipelineCLISubcommandExecutor)create_config_from_structurec                   d     e Zd Z	 	 	 d fd	Zed             Zd Zd Zed             Z	d Z
 xZS )	DocUnderstandingNc                 P    |||d| _          t                      j        di | d S )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/banglarbhumi/venv/lib/python3.11/site-packages/paddleocr/_pipelines/doc_understanding.pyr   zDocUnderstanding.__init__   sB     -I+F,H
 

 	""6"""""    c                     dS Ndoc_understandingr   r   s    r   _paddlex_pipeline_namez'DocUnderstanding._paddlex_pipeline_name*       ""r   c                 (     | j         j        |fi |S N)paddlex_pipelinepredictr   inputr   s      r   predict_iterzDocUnderstanding.predict_iter.   s     ,t$,U==f===r   c                 8    t           | j        |fi |          S r"   )listr'   r%   s      r   r$   zDocUnderstanding.predict1   s(    
 %D%e66v66777r   c                     t                      S r"   )%DocUnderstandingCLISubcommandExecutor)clss    r   get_cli_subcommand_executorz,DocUnderstanding.get_cli_subcommand_executor8   s    4666r   c                 n    | j         d         | j         d         | j         d         d}t          |          S )Nr   r   r   )z&SubModules.DocUnderstanding.model_namez%SubModules.DocUnderstanding.model_dirz&SubModules.DocUnderstanding.batch_size)r   r   )r   	STRUCTUREs     r   _get_paddlex_config_overridesz.DocUnderstanding._get_paddlex_config_overrides<   sI    6:l.7 6:\-6 7;l.7

 

	 ,I666r   )NNN)__name__
__module____qualname__r   propertyr   r'   r$   classmethodr-   r0   __classcell__)r   s   @r   r   r      s         &*$(%)	# # # # # # # # X#> > >8 8 8 7 7 [77 7 7 7 7 7 7r   r   c                   X    e Zd Z e ee                    Zed             Zd Z	d Z
dS )r+   c                     dS r   r   r   s    r   subparser_namez4DocUnderstandingCLISubcommandExecutor.subparser_nameN   r    r   c                     t          |d           |                    dt          d           |                    dt          d           |                    dt          d	           d S )
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_subparserz7DocUnderstandingCLISubcommandExecutor._update_subparserR   s    ! n	
 	
 	
 	

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

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

 	,C 	 	
 	
 	
 	
 	
r   c                     t          |          }|                     |d                   |d<   t          t          |           d S )Nr&   )r   input_validatorr   r   )r   argsparamss      r   execute_with_argsz7DocUnderstandingCLISubcommandExecutor.execute_with_argsh   sA    $T**..vg??w !16:::::r   N)r1   r2   r3   staticmethodr   dictrC   r4   r9   rA   rF   r   r   r   r+   r+   K   sd        "l;;t#4#455O# # X#
 
 
,; ; ; ; ;r   r+   N) paddlex.utils.pipeline_argumentsr   
_utils.clir   r   r   baser	   r
   utilsr   r   r+   r   r   r   <module>rM      s    9 8 8 8 8 8         
 H G G G G G G G / / / / / /.7 .7 .7 .7 .7- .7 .7 .7b ;  ;  ;  ;  ;,I  ;  ;  ;  ;  ;r   