
    RЦi9              '       	   S r SSKrSSKJrJrJr  SSKrSSKJrJ	r	  SSK
Jr  SSKJrJrJrJrJrJrJr  \" SS	9r\" S
S	9r\\\R.                  " SS	94   r\\\   \R2                  " SS	94   r\\\   \R2                  " SS	94   rS\SS4S jr\R;                  SS/S9S\R<                  SS4S\S\S\S\SS4
S jj5       r\R;                  SS/S9SSSSSSSSS.S\S\\\R2                  " SS	94   S \\\R2                  " S!S	94   S"\\\R2                  " S#S	94   S$\\\R2                  " S%S	94   S&\\\R2                  " S'S	94   S(\\\R2                  " S)S	94   S*\\\R2                  " S+S	94   S\S,\\\   \R2                  " S-S	94   S\S.\\ \R2                  " S/S	94   S0\\ \R2                  " S1S	94   S2\\\    \R2                  " S3S	94   S4\\\	   \R2                  " S5S	94   S6\\\!   \R2                  " S7S	94   SS4"S8 jj5       r"\R;                  SS9/S9    SYS\\\R2                  " SS	94   S\S"\\\   \R2                  " S:S	94   S\S\SS4S; jj5       r# SZS\SS4S< jjr$\R;                  S=S>/S9" \$5        \R;                  S?S@SA9" \$5        \RK                  \SBSC9  \R;                  SD/S9  S[S\S\S\SS4SE jj5       r&\R;                  SF/S9              S\S\S\S\\\   \R2                  " SS	94   S"\\\   \R2                  " S#S	94   S$\\\   \R2                  " S%S	94   S&\\\   \R2                  " S'S	94   S \\\   \R2                  " SGS	94   SH\\\   \R2                  " SIS	94   S,\\\   \R2                  " S-S	94   S.\\\    \R2                  " S/S	94   S0\\\    \R2                  " S1S	94   S2\\\    \R2                  " S3S	94   S4\\\	   \R2                  " S5S	94   S6\\\!   \R2                  " S7S	94   S\SS4 SJ jj5       r'\R;                  SK/S9   S]S\S\SL\\(\R2                  " SMSNS	94   S\SS4
SO jj5       r)\R;                  SP/S9  S[S\S\S\SS4SQ jj5       r*\R;                  SR/S9   S]S\S\SS\\(\R2                  " STSUS	94   S\SS4
SV jj5       r+\R;                  SW/S9  S[S\S\S\SS4SX jj5       r,g)^z2CLI commands for Hugging Face Inference Endpoints.    N)	AnnotatedAnyOptional)InferenceEndpointInferenceEndpointScalingMetric)HfHubHTTPError   )	FormatOptOutputFormatQuietOptTokenOpt
get_hf_apiprint_list_outputtyper_factoryz(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.endpointreturnc                 l    [         R                  " [        R                  " U R                  SSS95        g )N   Tindent	sort_keys)typerechojsondumpsraw)r   s    f/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/huggingface_hub/cli/inference_endpoints.py_print_endpointr   ,   s    	JJtzz(,,qDAB    zhf endpoints lsz"hf endpoints ls --namespace my-org)examplesF	namespaceformatquiettokenc           	         [        US9n UR                  XS9nU Vs/ s H  owR                  PM     nnS[        [        [        4   S[        [           4S jn	[        UUUS	/ S
QU	S9  g! [         aG  n[        R                  " SU 35        [        R
                  " UR                  R                  S9UeSnAff = fs  snf )z6Lists all Inference Endpoints for the given namespace.r%   )r"   r%   zListing failed: codeNitemr   c                    U R                  S0 5      nU R                  S0 5      nU R                  S0 5      nU R                  S0 5      n[        U R                  SS5      5      [        [        U[        5      (       a  UR                  SS5      OS5      [        [        U[        5      (       a  UR                  SS5      OS5      [        [        U[        5      (       a  UR                  S	S5      OS5      [        [        U[        5      (       a  UR                  S
S5      OS5      [        [        U[        5      (       a  UR                  SS5      OS5      [        [        U[        5      (       a  UR                  SS5      OS5      [        [        U[        5      (       a  UR                  SS5      5      /$ S5      /$ )Nstatusmodelcomputeprovidername 
repositorystatetask	frameworkinstanceTypevendorregion)getstr
isinstancedict)r*   r,   r-   r.   r/   s        r   row_fnls.<locals>.row_fnA   sY   (B'"%((9b)88J+$%z%/F/F		,+BO:fd+C+C

7B'LE4)@)@		&"%bIj.E.E		+r*2N:gt3L3LNB/RTUj4.H.HXr*bQj4.H.HXr*Q	
 		
 OQQ	
 		
r    r0   )NAMEMODELSTATUSTASK	FRAMEWORKINSTANCEVENDORREGION)itemsr#   r$   id_keyheadersr=   )r   list_inference_endpointsr   r   r   Exitresponsestatus_coder   r<   r:   r   listr   )
r"   r#   r$   r%   api	endpointserrorr   resultsr=   s
             r   lsrS   0   s     5
!CE0090R	
 -66I||IG6
T#s(^ 
S	 
  `-  E

%eW-.jjenn889uDE 7s   A+ B?+
B<5AB77B<deployzChf endpoints deploy my-endpoint --repo gpt2 --framework pytorch ...)r0   r!   )r"   r4   r%   min_replicamax_replicascale_to_zero_timeoutscaling_metricscaling_thresholdr0   repozeThe name of the model repository associated with the Inference Endpoint (e.g. 'openai/gpt-oss-120b').r5   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').r8   zTThe cloud region in which the Inference Endpoint will be created (e.g. 'us-east-1').r7   zVThe cloud provider or vendor where the Inference Endpoint will be hosted (e.g. 'aws').r4   zCThe task on which to deploy the model (e.g. 'text-classification').rU   zVThe minimum number of replicas (instances) to keep running for the Inference Endpoint.rV   zRThe maximum number of replicas (instances) to scale to for the Inference Endpoint.rW   zFThe duration in minutes before an inactive endpoint is scaled to zero.rX   z!The metric reference for scaling.rY   zeThe scaling metric threshold used to trigger a scale up. Ignored when scaling metric is not provided.c                h    [        U
S9nUR                  U UUUUUUUUU	U
UUUUUS9n[        U5        g)z3Deploy an Inference Endpoint from a Hub repository.r'   )r0   r2   r5   r[   r\   r]   r8   r7   r"   r4   r%   rU   rV   rX   rY   rW   N)r   create_inference_endpointr   )r0   rZ   r5   r[   r\   r]   r8   r7   r"   r4   r%   rU   rV   rW   rX   rY   rO   r   s                     r   rT   rT   [   s^    l 5
!C,,##%+3! - H& Hr    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                     [        US9n UR                  U UUUUS9n[        U5        g! [         aG  n[        R                  " SU 35        [        R
                  " UR                  R                  S9UeSnAff = f)z4Deploy an Inference Endpoint from the Model Catalog.r'   )repo_idr0   r[   r"   r%   zDeployment failed: r(   N)	r   &create_inference_endpoint_from_catalogr   r   r   rK   rL   rM   r   )rZ   r0   r[   r"   r%   rO   r   rQ   s           r   deploy_from_catalogrc      s    & 5
!C
E==# > 
 H	  E

(01jjenn889uDEs   * 
A;AA66A;c                 6   [        U S9n UR                  U S9n[        R                  " [        R                  " SU0SSS95        g! [         aG  n[        R                  " SU 35        [        R
                  " UR                  R                  S9UeSnAff = f)	zList available Catalog models.r'   zCatalog fetch failed: r(   Nmodelsr   Tr   )
r   list_inference_catalogr   r   r   rK   rL   rM   r   r   )r%   rO   re   rQ   s       r   list_catalogrg      s     5
!CE++%+8
 
JJtzz8V,Q$GH	  E

+E734jjenn889uDEs   A 
BABBrS   zhf endpoints catalog lszlist-catalogT)r0   hiddencatalog)r0   z!hf endpoints describe my-endpointc                     [        US9n UR                  XUS9n[        U5        g! [         aG  n[        R                  " SU 35        [        R
                  " UR                  R                  S9UeSnAff = f)z+Get information about an existing endpoint.r'   r0   r"   r%   zFetch failed: r(   N)	r   get_inference_endpointr   r   r   rK   rL   rM   r   r0   r"   r%   rO   r   rQ   s         r   describern      sv     5
!CE--4TY-Z
 H	  E

^E7+,jjenn889uDE   ' 
A8AA33A8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                    [        US9n UR                  U UUUUUUUUU	U
UUUUS9n[        U5        g! [         aG  n[        R                  " SU 35        [        R
                  " UR                  R                  S9UeSnAff = f)zUpdate an existing endpoint.r'   )r0   r"   r2   r5   rp   r4   r[   r\   r]   rU   rV   rW   rX   rY   r%   zUpdate failed: r(   N)	r   update_inference_endpointr   r   r   rK   rL   rM   r   )r0   r"   rZ   r[   r\   r]   r5   rp   r4   rU   rV   rW   rX   rY   r%   rO   r   rQ   s                     r   updaters     s    ^ 5
!CE00#''##"7)/ 1 
( H  E

_UG,-jjenn889uDEs   4 
BAB  Bzhf endpoints delete my-endpointyesz--yeszSkip confirmation prompts.c                    U(       dI  [         R                  " SU  S35      nX@:w  a*  [         R                  " S5        [         R                  " SS9e[	        US9n UR                  XUS9  [         R                  " S
U  S35        g	! [         aG  n[         R                  " SU 35        [         R                  " UR                  R                  S9UeS	nAff = f)z)Delete an Inference Endpoint permanently.zDelete endpoint 'z'? Type the name to confirm.zAborted.r   r(   r'   rk   zDelete failed: Nz	Deleted 'z'.)	r   promptr   rK   r   delete_inference_endpointr   rL   rM   )r0   r"   rt   r%   confirmationrO   rQ   s          r   deletery   y  s     ||&7v=Y$Z[JJz"**!$$
5
!CE%%4E%R
 
JJ4&#$	  E

_UG,-jjenn889uDEs   B 
CACCzhf endpoints pause my-endpointc                     [        US9n UR                  XUS9n[        U5        g! [         aG  n[        R                  " SU 35        [        R
                  " UR                  R                  S9UeSnAff = f)zPause an Inference Endpoint.r'   rk   zPause failed: r(   N)	r   pause_inference_endpointr   r   r   rK   rL   rM   r   rm   s         r   pauser|     sv     5
!CE//TV[/\
 H	  E

^E7+,jjenn889uDEro   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                    [        US9n UR                  U UUU(       + S9n[        U5        g! [         aG  n[        R                  " SU 35        [        R
                  " UR                  R                  S9UeSnAff = f)zResume an Inference Endpoint.r'   )r0   r"   r%   
running_okzResume failed: r(   N)	r   resume_inference_endpointr   r   r   rK   rL   rM   r   )r0   r"   r}   r%   rO   r   rQ   s          r   resumer     s     5
!C	E0022	 1 
 H  E

_UG,-jjenn889uDEs   . 
A?AA::A?z&hf endpoints scale-to-zero my-endpointc                     [        US9n UR                  XUS9n[        U5        g! [         aG  n[        R                  " SU 35        [        R
                  " UR                  R                  S9UeSnAff = f)z$Scale an Inference Endpoint to zero.r'   rk   zScale To Zero failed: r(   N)	r    scale_to_zero_inference_endpointr   r   r   rK   rL   rM   r   rm   s         r   scale_to_zeror     sw     5
!CE77T^c7d
 H	  E

+E734jjenn889uDEro   )NNNN)N)NN)NNNNNNNNNNNNNN)NFN)-__doc__r   typingr   r   r   r   $huggingface_hub._inference_endpointsr   r   huggingface_hub.errorsr   
_cli_utilsr
   r   r   r   r   r   r   ie_clicatalog_appr:   ArgumentNameArgOptionNameOptNamespaceOptr   commandtablerS   intfloatrT   rc   rg   	add_typerrn   rs   boolry   r|   r   r    r    r   <module>r      st	   8  + +  b 1   
F	G!QR 	NN()+ SM	LL&')
 SM	LLnC/ CD C +-QRS"$**	''' ' 	'
 
' T'T X)n(op\ # 	 	
 	
 	 	 	ei
i
x	
	i S	
	i R	
	i( a	
	)i4 l	
	5i@ g	
	AiL i	
	MiZ [i\ V	
	]ih iij i	
	kiv e	
	wiB %Y	
	CiN /04	
	OiZ !x	
	[if 
gi qiX (.s-tu  	"
x	
	  c	
	    
! vF II	I   )B(C  D\ R N4 0 >   9  - =>? #
  
	 @  KLM # 	 	 	 	 	 	 	 	 	 	 	 	Wd
dd x	
	d R	
	d a	
	d* l	
	+d6 U	
	7dB  F	
	CdN V	
	OdZ i	
	[df e	
	gdr %Y	
	sd~ /04	
	dJ !x	
	KdV WdX 
Yd NdN ;<= # 	%
%% 
W#?@	B
% % 
% >%4 :;< #
  
	 =  ;<= # 	
 ''j	
	  
 >6 BCD #
  
	 Er    