
    kh                         d dl mZmZmZmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ej                  eej                  ee
j                  e
iZ	 	 	 	 dded	ee   d
ee   dee   deeeef      ddfdZy)    )OptionalDictUnionList   )Detectron2LayoutModel)PaddleDetectionLayoutModel)EfficientDetLayoutModel)$is_lp_layout_model_config_any_formatNconfig_path
model_path	label_mapdeviceextra_configreturnBaseLayoutModelc                 ~    t        |       st        d|        t        D ]  }|| v st        |   | ||||      c S  y)a  [summary]

    Args:
        config_path (:obj:`str`):
            The path to the configuration file.
        model_path (:obj:`str`, None):
            The path to the saved weights of the model.
            If set, overwrite the weights in the configuration file.
            Defaults to `None`.
        label_map (:obj:`dict`, optional):
            The map from the model prediction (ids) to real
            word labels (strings). If the config is from one of the supported
            datasets, Layout Parser will automatically initialize the label_map.
            Defaults to `None`.
        device(:obj:`str`, optional):
            Whether to use cuda or cpu devices. If not set, LayoutParser will
            automatically determine the device to initialize the models on. 
        extra_config (:obj:`dict`, optional):
            Extra configuration passed used for initializing the layout model.

    Returns:
        # BaseLayoutModel: the create LayoutModel instance
    zInvalid model config_path )r   r   r   r   N)r   
ValueErrorALL_AVAILABLE_BACKENDS)r   r   r   r   r   backend_names         `/var/www/teggl/fontify/venv/lib/python3.12/site-packages/layoutparser/models/auto_layoutmodel.pyAutoLayoutModelr      sW    < 0<5k]CDD. ;&),7%#)     )NNNN)typingr   r   r   r   detectron2.layoutmodelr   paddledetection.layoutmodelr	   effdet.layoutmodelr
   model_configr   DETECTOR_NAMEr   strr    r   r   <module>r"      s    / . 9 C 7
 '')>,,.H))+B  !%".2((( ~( SM	(
 5t,-( (r   