Ë
    Z²jØ6  ã            &       óZ
  — d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	m
Z
mZ ddlmZ  ed	¬
«      Z ed¬
«      Zee ej"                  d¬
«      f   Zeedz   ej&                  d¬
«      f   Zeedz   ej&                  d¬
«      f   Zej-                  dddg¬«      	 	 dUdede	ddfd„«       Zej-                  ddg¬«      dddddddddœdedee ej&                  d¬
«      f   dee ej&                  d¬
«      f   dee ej&                  d ¬
«      f   d!ee ej&                  d"¬
«      f   d#ee ej&                  d$¬
«      f   d%ee ej&                  d&¬
«      f   d'ee ej&                  d(¬
«      f   ded)eedz   ej&                  d*¬
«      f   de	d+ee ej&                  d,¬
«      f   d-ee ej&                  d.¬
«      f   d/eedz   ej&                  d0¬
«      f   d1eedz   ej&                  d2¬
«      f   d3eedz   ej&                  d4¬
«      f   ddf"d5„«       Zej-                  dd6g¬«      	 	 	 	 dVdee ej&                  d¬
«      f   dedeedz   ej&                  d7¬
«      f   dede	ddfd8„«       Z	 dWde	ddfd9„Z ej-                  dd:g¬«      e«        ej-                  d;d<¬=«      e«       ej;                  ed>¬?«       ej-                  d@g¬«      	 	 dUdedede	ddfdA„«       Zej-                  dBg¬«      	 	 	 	 	 	 	 	 	 	 	 	 	 	 dXdededeedz   ej&                  d¬
«      f   deedz   ej&                  d ¬
«      f   d!eedz   ej&                  d"¬
«      f   d#eedz   ej&                  d$¬
«      f   deedz   ej&                  dC¬
«      f   dDeedz   ej&                  dE¬
«      f   d)eedz   ej&                  d*¬
«      f   d+eedz   ej&                  d,¬
«      f   d-eedz   ej&                  d.¬
«      f   d/eedz   ej&                  d0¬
«      f   d1eedz   ej&                  d2¬
«      f   d3eedz   ej&                  d4¬
«      f   de	ddf dF„«       Zej-                  dGg¬«      	 	 	 dYdededHee  ej&                  dIdJ¬
«      f   de	ddf
dK„«       Z!ej-                  dLg¬«      	 	 dUdedede	ddfdM„«       Z"ej-                  dNg¬«      	 	 	 dYdededOee  ej&                  dPdQ¬
«      f   de	ddf
dR„«       Z#ej-                  dSg¬«      	 	 dUdedede	ddfdT„«       Z$y)Zz2CLI commands for Hugging Face Inference Endpoints.é    )Ú	AnnotatedN)ÚInferenceEndpointScalingMetric)ÚHfHubHTTPErroré   )ÚTokenOptÚ
get_hf_apiÚtyper_factory)Úoutz(Manage Hugging Face Inference Endpoints.)Úhelpz.Interact with the Inference Endpoints catalog.zEndpoint name.z_The namespace associated with the Inference Endpoint. Defaults to the current user's namespace.z	list | lszhf endpoints lsz"hf endpoints ls --namespace my-org)ÚexamplesÚ	namespaceÚtokenÚreturnc                 ó  — t        |¬«      }	 |j                  | |¬«      }g }|D �]o  }|j                  }|j                  di «      }|j                  di «      }	|j                  di «      }
|j                  d	i «      }|j                  |j                  d
d«      t        |	t        «      r|	j                  dd«      ndt        |t        «      r|j                  dd«      ndt        |	t        «      r|	j                  dd«      ndt        |	t        «      r|	j                  dd«      ndt        |
t        «      r|
j                  dd«      ndt        |t        «      r|j                  dd«      ndt        |t        «      r|j                  dd«      nddœ«       �Œr t        j                  |d
¬«       y# t        $ rH}t        j                  d|› �«       t        j                  |j                  j                  ¬«      |‚d}~ww xY w)z6Lists all Inference Endpoints for the given namespace.©r   )r   r   zListing failed: ©ÚcodeNÚstatusÚmodelÚcomputeÚproviderÚnameÚ Ú
repositoryÚstateÚtaskÚ	frameworkÚinstanceTypeÚvendorÚregion)r   r   r   r   r   Úinstancer   r    )Úid_key)r   Úlist_inference_endpointsr   r
   ÚerrorÚtyperÚExitÚresponseÚstatus_codeÚrawÚgetÚappendÚ
isinstanceÚdictÚtable)r   r   ÚapiÚ	endpointsr$   ÚresultsÚendpointr)   r   r   r   r   s               úf/var/www/html/ia-enhanced/venv/lib/python3.12/site-packages/huggingface_hub/cli/inference_endpoints.pyÚlsr4   $   s°  € ô ˜5Ô
!€CðEØ×0Ñ0¸9ÈEÐ0ÓRˆ	ð
 €GØó 
ˆØ�l‰lˆØ—‘˜ 2Ó&ˆØ—‘˜ Ó$ˆØ—'‘'˜) RÓ(ˆØ—7‘7˜: rÓ*ˆØ�‰àŸ™ ¨Ó+Ü8BÀ5Ì$Ô8O˜Ÿ™ <°Ô4ÐUWÜ5?ÀÌÔ5M˜&Ÿ*™* W¨bÔ1ÐSUÜ1;¸EÄ4Ô1H˜Ÿ	™	 &¨"Ô-ÈbÜ;EÀeÌTÔ;R˜UŸY™Y {°BÔ7ÐXZÜ?IÈ'ÔSWÔ?X˜GŸK™K¨¸Ô;Ð^`Ü8BÀ8ÌTÔ8R˜(Ÿ,™, x°Ô4ÐXZÜ8BÀ8ÌTÔ8R˜(Ÿ,™, x°Ô4ÐXZñ	ö	
ð
ô$ ‡I�Iˆg˜fÖ%øô/ ò EÜ�	‰	Ð$ U GÐ,Ô-Ü�j‰j˜eŸn™n×8Ñ8Ô9¸uÐDûðEús   ŽF0 Æ0	HÆ9AG<Ç<HÚdeployzChf endpoints deploy my-endpoint --repo gpt2 --framework pytorch ...)r   r   )r   r   r   Úmin_replicaÚmax_replicaÚscale_to_zero_timeoutÚscaling_metricÚscaling_thresholdr   ÚrepozeThe name of the model repository associated with the Inference Endpoint (e.g. 'openai/gpt-oss-120b').r   z@The machine learning framework used for the model (e.g. 'vllm').Úacceleratorz?The hardware accelerator to be used for inference (e.g. 'cpu').Úinstance_sizezNThe size or type of the instance to be used for hosting the model (e.g. 'x4').Úinstance_typezYThe cloud instance type where the Inference Endpoint will be deployed (e.g. 'intel-icl').r    zTThe cloud region in which the Inference Endpoint will be created (e.g. 'us-east-1').r   zVThe cloud provider or vendor where the Inference Endpoint will be hosted (e.g. 'aws').r   zCThe task on which to deploy the model (e.g. 'text-classification').r6   zVThe minimum number of replicas (instances) to keep running for the Inference Endpoint.r7   zRThe maximum number of replicas (instances) to scale to for the Inference Endpoint.r8   zFThe duration in minutes before an inactive endpoint is scaled to zero.r9   z!The metric reference for scaling.r:   zeThe scaling metric threshold used to trigger a scale up. Ignored when scaling metric is not provided.c                óœ   — t        |
¬«      }|j                  | |||||||||	|
|||||¬«      }t        j                  |j                  «       y)z3Deploy an Inference Endpoint from a Hub repository.r   )r   r   r   r<   r=   r>   r    r   r   r   r   r6   r7   r9   r:   r8   N)r   Úcreate_inference_endpointr
   r-   r)   )r   r;   r   r<   r=   r>   r    r   r   r   r   r6   r7   r8   r9   r:   r/   r2   s                     r3   r5   r5   G   sf   € ôl ˜5Ô
!€CØ×,Ñ,ØØØØØ#Ø#ØØØØØØØØ%Ø+Ø3ð! -ó €Hô$ ‡H�HˆX�\‰\Õó    zChf endpoints catalog deploy --repo meta-llama/Llama-3.2-1B-InstructzPThe hardware accelerator to be used for inference (e.g. 'cpu', 'gpu', 'neuron').c                 ó0  — t        |¬«      }	 |j                  | ||||¬«      }t        j                  |j                  «       y# t        $ rH}t        j                  d|› �«       t        j                  |j                  j                  ¬«      |‚d}~ww xY w)z4Deploy an Inference Endpoint from the Model Catalog.r   )Úrepo_idr   r<   r   r   zDeployment failed: r   N)r   Ú&create_inference_endpoint_from_catalogr   r
   r$   r%   r&   r'   r(   r-   r)   )r;   r   r<   r   r   r/   r2   r$   s           r3   Údeploy_from_catalogrE   ³   s�   € ô& ˜5Ô
!€Cð
EØ×=Ñ=ØØØ#ØØð >ó 
ˆô ‡H�HˆX�\‰\Õøô	 ò EÜ�	‰	Ð'¨ wÐ/Ô0Ü�j‰j˜eŸn™n×8Ñ8Ô9¸uÐDûðEúó   ŽA Á	BÁABÂBc                 ó  — t        | ¬«      }	 |j                  | ¬«      }t        j                  d|i«       y# t        $ rH}t        j                  d|› �«       t        j                  |j                  j                  ¬«      |‚d}~ww xY w)zList available Catalog models.r   zCatalog fetch failed: r   NÚmodels)
r   Úlist_inference_catalogr   r
   r$   r%   r&   r'   r(   r-   )r   r/   rH   r$   s       r3   Úlist_catalogrJ   Ö   s}   € ô ˜5Ô
!€CðEØ×+Ñ+°%Ð+Ó8ˆô
 ‡H�Hˆh˜ÐÕ øô	 ò EÜ�	‰	Ð*¨5¨'Ð2Ô3Ü�j‰j˜eŸn™n×8Ñ8Ô9¸uÐDûðEús   Ž8 ¸	B	ÁABÂB	zhf endpoints catalog lszlist-catalogT)r   ÚhiddenÚcatalog©r   z!hf endpoints describe my-endpointc                 ó,  — t        |¬«      }	 |j                  | ||¬«      }t        j                  |j                  «       y# t        $ rH}t        j                  d|› �«       t        j                  |j                  j                  ¬«      |‚d}~ww xY w)z+Get information about an existing endpoint.r   ©r   r   r   zFetch failed: r   N)r   Úget_inference_endpointr   r
   r$   r%   r&   r'   r(   r-   r)   ©r   r   r   r/   r2   r$   s         r3   ÚdescriberR   ë   s€   € ô ˜5Ô
!€CðEØ×-Ñ-°4À9ÐTYÐ-ÓZˆô
 ‡H�HˆX�\‰\Õøô	 ò EÜ�	‰	�N 5 'Ð*Ô+Ü�j‰j˜eŸn™n×8Ñ8Ô9¸uÐDûðEúó   ŽA Á	BÁABÂBz/hf endpoints update my-endpoint --min-replica 2zBThe machine learning framework used for the model (e.g. 'custom').ÚrevisionzrThe specific model revision to deploy on the Inference Endpoint (e.g. '6c0e6080953db56375760c0471a8c5f2929baf11').c                 óD  — t        |¬«      }	 |j                  | |||||||||	|
||||¬«      }t        j                  |j                  «       y# t        $ rH}t        j                  d|› �«       t        j                  |j                  j                  ¬«      |‚d}~ww xY w)zUpdate an existing endpoint.r   )r   r   r   r   rT   r   r<   r=   r>   r6   r7   r8   r9   r:   r   zUpdate failed: r   N)r   Úupdate_inference_endpointr   r
   r$   r%   r&   r'   r(   r-   r)   )r   r   r;   r<   r=   r>   r   rT   r   r6   r7   r8   r9   r:   r   r/   r2   r$   s                     r3   ÚupdaterW   ü   s«   € ô^ ˜5Ô
!€CðEØ×0Ñ0ØØØØØØØ#Ø'Ø'Ø#Ø#Ø"7Ø)Ø/Øð 1ó 
ˆô( ‡H�HˆX�\‰\Õøô ò EÜ�	‰	�O E 7Ð+Ô,Ü�j‰j˜eŸn™n×8Ñ8Ô9¸uÐDûðEús   Ž A Á	BÁABÂBzhf endpoints delete my-endpointÚyesz--yeszSkip confirmation prompts.c                 óZ  — t        j                  d| › d�|¬«       t        |¬«      }	 |j                  | ||¬«       t        j                  d	| › d
�| ¬«       y# t        $ rH}t        j
                  d|› �«       t        j                  |j                  j                  ¬«      |‚d}~ww xY w)z)Delete an Inference Endpoint permanently.zDelete endpoint 'z'?)rX   r   rO   zDelete failed: r   Nz	Deleted 'z'.rM   )r
   Úconfirmr   Údelete_inference_endpointr   r$   r%   r&   r'   r(   Úresult)r   r   rX   r   r/   r$   s         r3   Údeleter]   d  sœ   € ô ‡K�KÐ# D 6¨Ð,°#Õ6ä
˜5Ô
!€CðEØ×%Ñ%¨4¸9ÈEÐ%ÔRô
 ‡J�J�˜4˜& Ð#¨$Ö/øô	 ò EÜ�	‰	�O E 7Ð+Ô,Ü�j‰j˜eŸn™n×8Ñ8Ô9¸uÐDûðEús   ©A Á	B*Á"AB%Â%B*zhf endpoints pause my-endpointc                 ó,  — t        |¬«      }	 |j                  | ||¬«      }t        j                  |j                  «       y# t        $ rH}t        j                  d|› �«       t        j                  |j                  j                  ¬«      |‚d}~ww xY w)zPause an Inference Endpoint.r   rO   zPause failed: r   N)r   Úpause_inference_endpointr   r
   r$   r%   r&   r'   r(   r-   r)   rQ   s         r3   Úpauser`   {  s€   € ô ˜5Ô
!€CðEØ×/Ñ/°TÀYÐV[Ð/Ó\ˆô
 ‡H�HˆX�\‰\Õøô	 ò EÜ�	‰	�N 5 'Ð*Ô+Ü�j‰j˜eŸn™n×8Ñ8Ô9¸uÐDûðEúrS   zhf endpoints resume my-endpointÚfail_if_already_runningz--fail-if-already-runningzWIf `True`, the method will raise an error if the Inference Endpoint is already running.c                 ó0  — t        |¬«      }	 |j                  | ||| ¬«      }t        j                  |j                  «       y# t        $ rH}t        j                  d|› �«       t        j                  |j                  j                  ¬«      |‚d}~ww xY w)zResume an Inference Endpoint.r   )r   r   r   Ú
running_okzResume failed: r   N)r   Úresume_inference_endpointr   r
   r$   r%   r&   r'   r(   r-   r)   )r   r   ra   r   r/   r2   r$   s          r3   Úresumere   Œ  sŒ   € ô ˜5Ô
!€Cð	EØ×0Ñ0ØØØØ2Ð2ð	 1ó 
ˆô ‡H�HˆX�\‰\Õøô ò EÜ�	‰	�O E 7Ð+Ô,Ü�j‰j˜eŸn™n×8Ñ8Ô9¸uÐDûðEúrF   z&hf endpoints scale-to-zero my-endpointc                 ó,  — t        |¬«      }	 |j                  | ||¬«      }t        j                  |j                  «       y# t        $ rH}t        j                  d|› �«       t        j                  |j                  j                  ¬«      |‚d}~ww xY w)z$Scale an Inference Endpoint to zero.r   rO   zScale To Zero failed: r   N)r   Ú scale_to_zero_inference_endpointr   r
   r$   r%   r&   r'   r(   r-   r)   rQ   s         r3   Úscale_to_zerorh   ¨  s�   € ô ˜5Ô
!€CðEØ×7Ñ7¸TÈYÐ^cÐ7Ódˆô
 ‡H�HˆX�\‰\Õøô	 ò EÜ�	‰	Ð*¨5¨'Ð2Ô3Ü�j‰j˜eŸn™n×8Ñ8Ô9¸uÐDûðEúrS   )NN)NNNN)N)NNNNNNNNNNNNNN)NFN)%Ú__doc__Útypingr   r%   Ú$huggingface_hub._inference_endpointsr   Úhuggingface_hub.errorsr   Ú
_cli_utilsr   r   r	   Ú_outputr
   Úie_cliÚcatalog_appÚstrÚArgumentÚNameArgÚOptionÚNameOptÚNamespaceOptÚcommandr4   ÚintÚfloatr5   rE   rJ   Ú	add_typerrR   rW   Úboolr]   r`   re   rh   © rA   r3   ú<module>r}      ss	  ðÙ 8å ã å OÝ 1ç ;Ñ ;Ý ñ 
ÐFÔ	G€áÐ!QÔR€ð ØØ€E‡N�NÐ(Ô)ð+ñ€ð Øˆ$�JØ€E‡L�LÐ&Ô'ð)ñ€ð
 Øˆ$�JØ€E‡L�LØnôðñ€ð ‡��Ð'8Ð:^Ð&_€Ó`à"Øñ&Øð&àð&ð 
ò&ó að&ðD ‡��XÐ)nÐ(o€Ópð\ #ð 	Øð 	
ð 	
ð 	ð 	ð 	òehØ
ðhà
ØØˆ�‰Øxô	
ð	ñðhð ØØˆ�‰ØSô	
ð	ñðhð ØØˆ�‰ØRô	
ð	ñðhð( ØØˆ�‰Øaô	
ð	ñð)hð4 ØØˆ�‰Ølô	
ð	ñð5hð@ ØØˆ�‰Øgô	
ð	ñðAhðL ØØˆ�‰Øiô	
ð	ñðMhðZ ð[hð\ Øˆd‰
Øˆ�‰ØVô	
ð	ñð]hðh ðihðj ØØˆ�‰Øiô	
ð	ñðkhðv ØØˆ�‰Øeô	
ð	ñðwhðB %Øˆd‰
Øˆ�‰ØYô	
ð	ñðChðN Ø&¨Ñ-Øˆ�‰Ø4ô	
ð	ñðOhðZ !Ø�‰Øˆ�‰Øxô	
ð	ñð[hðf 
òghó qðhðV ×Ñ˜(Ð.sÐ-tÐÓuð ð 	Ø"ØñØ
ØØˆ�‰Øxô	
ð	ñðð ðð Øˆd‰
Øˆ�‰Øcô	
ð	ñðð ðð ðð  
ò!ó vððF ñ!Øð!à	ó!ð L€× Ñ ˜Ð0IÐ/JÐ Ó KÈLÔ YØ 0€‡��N¨4€Ó 0°Ô >ð × Ñ � 9Ð Ô -ð ‡�Ð=Ð>€Ó?ð #ØñØ
ðàðð ðð 
ò	ó @ðð  ‡�ÐKÐL€ÓMð #ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ØñWdØ
ðdàðdð Øˆd‰
Øˆ�‰Øxô	
ð	ñðdð Øˆd‰
Øˆ�‰ØRô	
ð	ñðdð Øˆd‰
Øˆ�‰Øaô	
ð	ñðdð* Øˆd‰
Øˆ�‰Ølô	
ð	ñð+dð6 Øˆd‰
Øˆ�‰ØUô	
ð	ñð7dðB Øˆd‰
Øˆ�‰ð Fô	
ð	ñðCdðN Øˆd‰
Øˆ�‰ØVô	
ð	ñðOdðZ Øˆd‰
Øˆ�‰Øiô	
ð	ñð[dðf Øˆd‰
Øˆ�‰Øeô	
ð	ñðgdðr %Øˆd‰
Øˆ�‰ØYô	
ð	ñðsdð~ Ø&¨Ñ-Øˆ�‰Ø4ô	
ð	ñðdðJ !Ø�‰Øˆ�‰Øxô	
ð	ñðKdðV ðWdðX 
òYdó NðdðN ‡�Ð;Ð<€Ó=ð #ð 	Øñ0Ø
ð0àð0ð 
ØØˆ�‰�WÐ#?Ô@ð	Bñ
ð0ð ð0ð 
ò0ó >ð0ð, ‡�Ð:Ð;€Ó<ð #ØñØ
ðàðð ðð 
ò	ó =ðð  ‡�Ð;Ð<€Ó=ð #ð 	ØñØ
ðàðð 'ØØˆ�‰Ø'Øjô	
ð	ñðð ðð 
òó >ðð6 ‡�ÐBÐC€ÓDð #ØñØ
ðàðð ðð 
ò	ó EñrA   