
    9i                          S SK JrJr  S SKrS SKJr  S SKJr  S SK	J
r
  S SKJr  S SKJr  S SKJr  S	/r\R$                  " \R&                  \R(                  S
9 " S S	\5      5       rg)    )AnyDictN)	Pipelines)Model)
OutputKeys)Pipeline)	PIPELINES)TasksPipelineTemplate)module_namec            	          ^  \ rS rSrSrS\4U 4S jjr  SS\S\S\	S\4S	 jjr
  SS\S\S\	S\4S
 jjr SS\S\S\\\4   4S jjrSrU =r$ )r      a  A pipeline template explain how to define parameters and input and
output information. As a rule, the first parameter is the input,
followed by the request parameters. The parameter must add type
hint information, and set the default value if necessary,
for the convenience of use.
modelc                 *   > [         TU ]  " SSU0UD6  g)znA pipeline template to describe input and
output and parameter processing

Args:
    model: A Model instance.
r   N )super__init__)selfr   kwargs	__class__s      f/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/modelscope/pipelines/pipeline_template.pyr   PipelineTemplate.__init__   s     	/u//    input
max_lengthtop_preturnc                     g)a4  Pipeline preprocess interface.

Args:
    input (Any): The pipeline input, ref Tasks.task_template TASK_INPUTS.
    max_length (int, optional): The max_length parameter. Defaults to 1024.
    top_p (float, optional): The top_p parameter. Defaults to 0.8.

Returns:
    Any: Return result process by forward.
Nr   r   r   r   r   s       r   
preprocessPipelineTemplate.preprocess%        	r   c                     g)zThe forward interface.

Args:
    input (Any): The output of the preprocess.
    max_length (int, optional): max_length. Defaults to 1024.
    top_p (float, optional): top_p. Defaults to 0.8.

Returns:
    Any: Return result process by postprocess.
Nr   r   s       r   forwardPipelineTemplate.forward5   r"   r   inputspostprocess_param1c           	          [         R                  [        R                  " S5      [         R                  [        R                  " SS5      [         R
                  [        R                  " SS5      0nU$ )zThe postprocess interface.

Args:
    input (Any): The output of the forward.
    max_length (int, optional): max_length. Defaults to 1024.
    top_p (float, optional): top_p. Defaults to 0.8.

Returns:
    Any: Return result process by postprocess.
   
      i  )r   BOXESnpzeros
OUTPUT_IMGTEXT_EMBEDDING)r   r&   r'   results       r   postprocessPipelineTemplate.postprocessE   sP     bhhqk!!288B?%%rxx4'8

 r   r   )i   g?)N)__name__
__module____qualname____firstlineno____doc__r   r   r   intfloatr    r$   strr   r2   __static_attributes____classcell__)r   s   @r   r   r      s    0e 0 &*"%"   +.$ #'"  (+$ /3(+7;CH~ r   )typingr   r   numpyr-   modelscope.metainfor   !modelscope.models.base.base_modelr   modelscope.outputs.outputsr   modelscope.pipelines.baser   modelscope.pipelines.builderr	   modelscope.utils.constantr
   __all__register_moduletask_templatepipeline_templater   r   r   r   <module>rJ      sc      ) 3 1 . 2 +
 	Y%@%@BDx DBDr   