
    kh                        d dl mZ ddlmZ dddddd	d
dddiddidddddidZddddddddddiddidddddidZd d!d"d#d$d%d&d'd(d$d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d d*id<d=idZ G d> d?e      Z ej                   e              y@)A    )PathHandler   )PathManagerz>https://www.dropbox.com/s/6icw6at8m28a2ho/model_final.pth?dl=1z>https://www.dropbox.com/s/893paxpy5suvlx9/model_final.pth?dl=1z>https://www.dropbox.com/s/yxsloxu3djt456i/model_final.pth?dl=1)faster_rcnn_R_50_FPN_3xmask_rcnn_R_50_FPN_3xretinanet_R_50_FPN_3xz>https://www.dropbox.com/s/dgy9c10wykk4lq4/model_final.pth?dl=1z>https://www.dropbox.com/s/d9fc9tahfzyl6df/model_final.pth?dl=1z>https://www.dropbox.com/s/57zjbwv6gh3srry/model_final.pth?dl=1)r   r   mask_rcnn_X_101_32x8d_FPN_3xr   z>https://www.dropbox.com/s/h7th27jfv19rxiy/model_final.pth?dl=1r   z>https://www.dropbox.com/s/6ewh6g8rqt2ev3a/model_final.pth?dl=1z>https://www.dropbox.com/s/8v4uqmz1at9v72a/model_final.pth?dl=1z>https://www.dropbox.com/s/6vzfk8lk9xvyitg/model_final.pth?dl=1)r   faster_rcnn_R_101_FPN_3xz>https://www.dropbox.com/s/7xel0i3iqpm2p8y/model_final.pth?dl=1)	HJDataset	PubLayNetPrimaLayoutNewspaperNavigator	TableBankMFDz9https://www.dropbox.com/s/j4yseny2u0hn22r/config.yml?dl=1z9https://www.dropbox.com/s/4jmr3xanmxmjcf8/config.yml?dl=1z9https://www.dropbox.com/s/z8a8ywozuyc5c2x/config.yml?dl=1z9https://www.dropbox.com/s/f3b12qc4hc0yh4m/config.yml?dl=1z9https://www.dropbox.com/s/u9wbsfwz4y0ziki/config.yml?dl=1z:https://www.dropbox.com/s/nau5ut6zgthunil/config.yaml?dl=1z:https://www.dropbox.com/s/yc92x97k50abynt/config.yaml?dl=1z9https://www.dropbox.com/s/wnido8pk4oubyzr/config.yml?dl=1z:https://www.dropbox.com/s/7cqle02do7ah7k4/config.yaml?dl=1z:https://www.dropbox.com/s/h63n6nv51kfl923/config.yaml?dl=1z:https://www.dropbox.com/s/ld9izb95f19369w/config.yaml?dl=1z
Page FrameRowzTitle RegionzText RegionTitleSubtitleOther)   r                  TextListTableFigure)r   r   r   r   r   
TextRegionImageRegionTableRegionMathsRegionSeparatorRegionOtherRegion)r   r   r   r   r   r   
PhotographIllustrationMapzComics/CartoonzEditorial CartoonHeadlineAdvertisement)r   r   r   r   r   r   r   r   Equationc                   (    e Zd ZdZdZd Zd ZddZy)"LayoutParserDetectron2ModelHandlerz<
    Resolve anything that's in LayoutParser model zoo.
    zlp://detectron2/c                     | j                   gS N)PREFIX)selfs    b/var/www/teggl/fontify/venv/lib/python3.12/site-packages/layoutparser/models/detectron2/catalog.py_get_supported_prefixesz:LayoutParserDetectron2ModelHandler._get_supported_prefixesz   s    }    c                 (   |t        | j                        d  }|j                  d      ^}}}|dk(  rt        |   dj	                  |         }n/|dk(  rt
        |   dj	                  |         }nt        d|       t        j                  |fi |S )N/weightconfigzUnknown data_type )	lenr/   splitMODEL_CATALOGjoinCONFIG_CATALOG
ValueErrorr   get_local_path)r0   pathkwargs
model_namedataset_name	data_type	model_urls          r1   _get_local_pathz2LayoutParserDetectron2ModelHandler._get_local_path}   s    #dkk*,-
/9/?/?/D,z9 %l3CHHZ4HII("&|4SXXj5IJI1)=>>)))>v>>r3   c                 N    t        j                  | j                  |      |fi |S r.   )r   openrE   )r0   r?   moder@   s       r1   _openz(LayoutParserDetectron2ModelHandler._open   s%     4 4T :DKFKKr3   N)r)__name__
__module____qualname____doc__r/   r2   rE   rI    r3   r1   r,   r,   s   s      F?Lr3   r,   N)	iopath.common.file_ior   base_catalogr   r:   r<   LABEL_MAP_CATALOGr,   register_handlerrO   r3   r1   <module>rT      sv   . & $d!a!a $d!a(h 	 !a 	"#c $d$d
 	"#c+8 $_!\!\ $_!\(d 	 !] 	"#^ $`$`
 	"#_+:     	
7 	
:I' VL L6   ?A Br3   