
    =pj	                     n    S r SSKJrJrJr  SSKJr  S\S\S\4S jr	 SS	\S
\\
   S\S\\\4   4S jjrg)z'Shared utilities for DocVLM predictors.    )AnyDictList   )MODEL_GROUP
model_name
group_namereturnc                 F    U [         R                  " U[        5       5      ;   $ )z5Check if model_name belongs to the given model group.)r   getset)r   r	   s     b/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/paddlex/inference/models/doc_vlm/utils.pyis_in_groupr      s    SU;;;    model_predssrc_dataadd_input_pathc                    [        U [        5      (       d  U /n [        U[        5      (       d  U/n/ nU HQ  n[        U5      nU(       a+  UR                  SS5      n[        U[        5      (       a  XTS'   UR                  U5        MS     [        U 5      [        U5      :w  a$  [        S[        U 5       S[        U5       S35      eUS   R                  5        Vs0 s H  of/ _M     nn/ US'   [        X05       HE  u  pUR                  5        H  nXv   R                  X   5        M     US   R                  U	5        MG     U$ s  snf )	a>  Format model predictions and source data into a result dict.

Args:
    model_preds: Model predictions (single or list).
    src_data: Source data list.
    add_input_path: If True, add input_path from image when image is a path string.

Returns:
    Dict with keys from src_data plus "result" containing predictions.
imageN
input_pathzModel predicts z results while src data has z	 samples.r   result)

isinstancelistdictr   strappendlen
ValueErrorkeyszip)
r   r   r   
input_infodatar   krst_format_dictdata_sample
model_preds
             r   format_doc_vlm_result_dictr'      sD    k4(("mh%%:JDzHHWd+E%%%%*\"$  ;3z?*c+.//KCPZOK\\ef
 	
 '1m&8&8&:;&:"u&:O; "OH#&z#?!!#A%%kn5 $!((4 $@
  <s   EN)T)__doc__typingr   r   r   	constantsr   r   boolr   r   r'    r   r   <module>r-      se    . " " "<C <S <T < DH(( $T
(<@(	#t)_(r   