Skip to content

Commit

Permalink
remove newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin committed Aug 13, 2024
1 parent cd47edb commit 392e96e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/huggingface_hub/inference/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2646,6 +2646,7 @@ def get_endpoint_info(self, *, model: Optional[str] = None) -> Dict[str, Any]:
url = model.rstrip("/") + "/info"
else:
url = f"{INFERENCE_ENDPOINT}/models/{model}/info"

response = get_session().get(url, headers=self.headers)
hf_raise_for_status(response)
return response.json()
Expand Down Expand Up @@ -2680,6 +2681,7 @@ def health_check(self, model: Optional[str] = None) -> bool:
"Model must be an Inference Endpoint URL. For serverless Inference API, please use `InferenceClient.get_model_status`."
)
url = model.rstrip("/") + "/health"

response = get_session().get(url, headers=self.headers)
return response.status_code == 200

Expand Down Expand Up @@ -2719,6 +2721,7 @@ def get_model_status(self, model: Optional[str] = None) -> ModelStatus:
if model.startswith("https://"):
raise NotImplementedError("Model status is only available for Inference API endpoints.")
url = f"{INFERENCE_ENDPOINT}/status/{model}"

response = get_session().get(url, headers=self.headers)
hf_raise_for_status(response)
response_data = response.json()
Expand Down
3 changes: 3 additions & 0 deletions src/huggingface_hub/inference/_generated/_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2702,6 +2702,7 @@ async def get_endpoint_info(self, *, model: Optional[str] = None) -> Dict[str, A
url = model.rstrip("/") + "/info"
else:
url = f"{INFERENCE_ENDPOINT}/models/{model}/info"

async with self._get_client_session() as client:
response = await client.get(url, proxy=self.proxies)
response.raise_for_status()
Expand Down Expand Up @@ -2738,6 +2739,7 @@ async def health_check(self, model: Optional[str] = None) -> bool:
"Model must be an Inference Endpoint URL. For serverless Inference API, please use `InferenceClient.get_model_status`."
)
url = model.rstrip("/") + "/health"

async with self._get_client_session() as client:
response = await client.get(url, proxy=self.proxies)
return response.status == 200
Expand Down Expand Up @@ -2779,6 +2781,7 @@ async def get_model_status(self, model: Optional[str] = None) -> ModelStatus:
if model.startswith("https://"):
raise NotImplementedError("Model status is only available for Inference API endpoints.")
url = f"{INFERENCE_ENDPOINT}/status/{model}"

async with self._get_client_session() as client:
response = await client.get(url, proxy=self.proxies)
response.raise_for_status()
Expand Down

0 comments on commit 392e96e

Please sign in to comment.