
    _i'2              '       D	   S r SSKrSSK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  \" SS	9r\" S
S	9r\\\R$                  " SS	94   r\\\   \R(                  " SS	94   r\\\   \R(                  " SS	94   rS\SS4S jr\R1                  5         SIS\S\SS4S jj5       r\R1                  SS9SSSSSSSSS.S\S\\\R(                  " SS	94   S\\\R(                  " SS	94   S\\\R(                  " SS	94   S\\\R(                  " SS	94   S\\\R(                  " S S	94   S!\\\R(                  " S"S	94   S#\\\R(                  " S$S	94   S\S%\\\   \R(                  " S&S	94   S\S'\\\R(                  " S(S	94   S)\\\R(                  " S*S	94   S+\\\   \R(                  " S,S	94   S-\\\   \R(                  " S.S	94   S/\\\   \R(                  " S0S	94   SS4"S1 jj5       r\R1                  SS9   SJS\\\R(                  " SS	94   S\S\S\SS4
S2 jj5       r SKS\SS4S3 jjr\R1                  S4S9" \5        \R1                  S5S6S7S89" \5        \R?                  \S9S9  \R1                  5         SIS\S\S\SS4S: jj5       r \R1                  5                     SLS\S\S\\\   \R(                  " SS	94   S\\\   \R(                  " SS	94   S\\\   \R(                  " SS	94   S\\\   \R(                  " S S	94   S\\\   \R(                  " S;S	94   S<\\\   \R(                  " S=S	94   S%\\\   \R(                  " S&S	94   S'\\\   \R(                  " S(S	94   S)\\\   \R(                  " S*S	94   S+\\\   \R(                  " S,S	94   S-\\\   \R(                  " S.S	94   S/\\\   \R(                  " S0S	94   S\SS4 S> jj5       r!\R1                  5          SMS\S\S?\\"\R(                  " S@SAS	94   S\SS4
SB jj5       r#\R1                  5         SIS\S\S\SS4SC jj5       r$\R1                  5          SMS\S\SD\\"\R(                  " SESFS	94   S\SS4
SG jj5       r%\R1                  5         SIS\S\S\SS4SH jj5       r&g)Nz2CLI commands for Hugging Face Inference Endpoints.    N)	AnnotatedOptional)InferenceEndpointInferenceEndpointScalingMetric)HfHubHTTPError   )TokenOpt
get_hf_api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    c/var/www/html/land-ocr/venv/lib/python3.13/site-packages/huggingface_hub/cli/inference_endpoints.py_print_endpointr   #   s    	JJtzz(,,qDAB    	namespacetokenc           	      t   [        US9n UR                  XS9n[        R                  " [        R                  " SU Vs/ s H  oUR                  PM     sn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s  snf )
z6Lists all Inference Endpoints for the given namespace.r   )r   r   zListing failed: codeNitemsr   Tr   )r
   list_inference_endpointsr   r   r   Exitresponsestatus_coder   r   r   )r   r   api	endpointserrorr   s         r   lsr*   '   s     5
!CE0090R	
 
JJ

I>I||I>?	
	  E

%eW-.jjenn889uDE ?s   A! B5!
B2+AB--B2deploy)name)r   taskr   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').	frameworkz@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').regionzTThe cloud region in which the Inference Endpoint will be created (e.g. 'us-east-1').vendorzVThe 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').r.   zVThe minimum number of replicas (instances) to keep running for the Inference Endpoint.r/   zRThe maximum number of replicas (instances) to scale to for the Inference Endpoint.r0   zFThe duration in minutes before an inactive endpoint is scaled to zero.r1   z!The metric reference for scaling.r2   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   )r,   
repositoryr4   r5   r6   r7   r8   r9   r   r-   r   r.   r/   r1   r2   r0   N)r
   create_inference_endpointr   )r,   r3   r4   r5   r6   r7   r8   r9   r   r-   r   r.   r/   r0   r1   r2   r'   r   s                     r   r+   r+   =   s^    l 5
!C,,##%+3! - H& Hr   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)z4Deploy an Inference Endpoint from the Model Catalog.r   )repo_idr,   r   r   zDeployment failed: r    N)	r
   &create_inference_endpoint_from_catalogr   r   r   r$   r%   r&   r   )r3   r,   r   r   r'   r   r)   s          r   deploy_from_catalogr@      s     5
!C	E==	 > 
 H	  E

(01jjenn889uDEs   ) 
A:AA55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)	List available Catalog models.r   zCatalog fetch failed: r    Nmodelsr   Tr   )
r
   list_inference_catalogr   r   r   r$   r%   r&   r   r   )r   r'   rC   r)   s       r   list_catalogrE      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r*   zlist-catalogrB   T)r,   r   hiddencatalogc                     [        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   r,   r   r   zFetch failed: r    N)	r
   get_inference_endpointr   r   r   r$   r%   r&   r   r,   r   r   r'   r   r)   s         r   describerL      sv     5
!CE--4TY-Z
 H	  E

^E7+,jjenn889uDE   ' 
A8AA33A8zBThe 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   )r,   r   r;   r4   rN   r-   r5   r6   r7   r.   r/   r0   r1   r2   r   zUpdate failed: r    N)	r
   update_inference_endpointr   r   r   r$   r%   r&   r   )r,   r   r3   r5   r6   r7   r4   rN   r-   r.   r/   r0   r1   r2   r   r'   r   r)   s                     r   updaterQ      s    ^ 5
!CE00#''##"7)/ 1 
( H  E

_UG,-jjenn889uDEs   4 
BAB  B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   rI   zDelete failed: Nz	Deleted 'z'.)	r   promptr   r$   r
   delete_inference_endpointr   r%   r&   )r,   r   rR   r   confirmationr'   r)   s          r   deleterW   T  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c                     [        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   rI   zPause failed: r    N)	r
   pause_inference_endpointr   r   r   r$   r%   r&   r   rK   s         r   pauserZ   o  sv     5
!CE//TV[/\
 H	  E

^E7+,jjenn889uDErM   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   )r,   r   r   
running_okzResume failed: r    N)	r
   resume_inference_endpointr   r   r   r$   r%   r&   r   )r,   r   r[   r   r'   r   r)   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?c                     [        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   rI   zScale To Zero failed: r    N)	r
    scale_to_zero_inference_endpointr   r   r   r$   r%   r&   r   rK   s         r   scale_to_zerorb     sw     5
!CE77T^c7d
 H	  E

+E734jjenn889uDErM   )NN)NNN)N)NNNNNNNNNNNNNN)NFN)'__doc__r   typingr   r   r   $huggingface_hub._inference_endpointsr   r   huggingface_hub.errorsr   
_cli_utilsr	   r
   r   ie_clicatalog_appstrArgumentNameArgOptionNameOptNamespaceOptr   commandr*   intfloatr+   r@   rE   	add_typerrL   rQ   boolrW   rZ   r_   rb    r   r   <module>rv      s   8  &  b 1 ; ; 
F	G!QR
	NN()+ SM	LL&')
 SM	LLnC/ CD C " 
 * X\ # 	 	
 	
 	 	 	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 iX (# "
x	
	    
 $8 II	I     | , N)IRV WXd e   9  -  #
  
	    # 	 	 	 	 	 	 	 	 	 	 	 	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 dN  # 	%
%% 
W#?@	B
% % 
% %4  #
  
	    # 	
 ''j	
	  
 6  #
  
	 r   