class_docstr: Initialize a new Inference Client.
  
  [`InferenceClient`] aims to provide a unified experience to perform inference. The client can be used
  seamlessly with either the (free) Inference API or self-hosted Inference Endpoints.
  
  Args:
      model (`str`, `optional`):
          The model to run inference with. Can be a model id hosted on the Hugging Face Hub, e.g. `bigcode/starcoder`
          or a URL to a deployed Inference Endpoint. Defaults to None, in which case a recommended model is
          automatically selected for the task.
      token (`str`, *optional*):
          Hugging Face token. Will default to the locally saved token. Pass `token=False` if you don't want to send
          your token to the server.
      timeout (`float`, `optional`):
          The maximum number of seconds to wait for a response from the server. Loading a new model in Inference
          API can take up to several minutes. Defaults to None, meaning it will loop until the server is available.
      headers (`Dict[str, str]`, `optional`):
          Additional headers to send to the server. By default only the authorization and user-agent headers are sent.
          Values in this dictionary will override the default values.
      cookies (`Dict[str, str]`, `optional`):
          Additional cookies to send to the server.
docstr: List models currently deployed on the Inference API service.
  
  This helper checks deployed models framework by framework. By default, it will check the 4 main frameworks that
  are supported and account for 95% of the hosted models. However, if you want a complete list of models you can
  specify `frameworks="all"` as input. Alternatively, if you know before-hand which framework you are interested
  in, you can also restrict to search to this one (e.g. `frameworks="text-generation-inference"`). The more
  frameworks are checked, the more time it will take.
  
  <Tip>
  
  This endpoint is mostly useful for discoverability. If you already know which model you want to use and want to
  check its availability, you can directly use [`~InferenceClient.get_model_status`].
  
  </Tip>
  
  Args:
      frameworks (`Literal["all"]` or `List[str]` or `str`, *optional*):
          The frameworks to filter on. By default only a subset of the available frameworks are tested. If set to
          "all", all available frameworks will be tested. It is also possible to provide a single framework or a
          custom set of frameworks to check.
  
  Returns:
      `Dict[str, List[str]]`: A dictionary mapping task names to a sorted list of model IDs.
  
  Example:
  ```python
  >>> from huggingface_hub import InferenceClient
  >>> client = InferenceClient()
  
  # Discover zero-shot-classification models currently deployed
  >>> models = client.list_deployed_models()
  >>> models["zero-shot-classification"]
  ['Narsil/deberta-large-mnli-zero-cls', 'facebook/bart-large-mnli', ...]
  
  # List from only 1 framework
  >>> client.list_deployed_models("text-generation-inference")
  {'text-generation': ['bigcode/starcoder', 'meta-llama/Llama-2-70b-chat-hf', ...], ...}
  ```
docstr_tok: ["List","models","currently","deployed","on","the","Inference","API","service",".","This","helper","checks","deployed","models","framework","by","framework",".","By","default",",","it","will","check","the","4","main","frameworks","that","are","supported","and","account","for","95","%","of","the","hosted","models",".","However",",","if","you","want","a","complete","list","of","models","you","can","specify","`","frameworks=","''","all","''","`","as","input",".","Alternatively",",","if","you","know","before-hand","which","framework","you","are","interested","in",",","you","can","also","restrict","to","search","to","this","one","(","e.g",".","`","frameworks=","''","text-generation-inference","''","`",")",".","The","more","frameworks","are","checked",",","the","more","time","it","will","take",".","<","Tip",">","This","endpoint","is","mostly","useful","for","discoverability",".","If","you","already","know","which","model","you","want","to","use","and","want","to","check","its","availability",",","you","can","directly","use","[","`","~InferenceClient.get_model_status","`","]",".","<","\/Tip",">","Args",":","frameworks","(","`","Literal","[","``","all","''","]","`","or","`","List","[","str","]","`","or","`","str","`",",","*","optional","*",")",":","The","frameworks","to","filter","on",".","By","default","only","a","subset","of","the","available","frameworks","are","tested",".","If","set","to","``","all","''",",","all","available","frameworks","will","be","tested",".","It","is","also","possible","to","provide","a","single","framework","or","a","custom","set","of","frameworks","to","check",".","Returns",":","`","Dict","[","str",",","List","[","str","]","]","`",":","A","dictionary","mapping","task","names","to","a","sorted","list","of","model","IDs",".","Example",":","``","`","python",">",">",">","from","huggingface_hub","import","InferenceClient",">",">",">","client","=","InferenceClient","(",")","#","Discover","zero-shot-classification","models","currently","deployed",">",">",">","models","=","client.list_deployed_models","(",")",">",">",">","models","[","``","zero-shot-classification","''","]","[","'Narsil\/deberta-large-mnli-zero-cls","'",",","'facebook\/bart-large-mnli","'",",","...","]","#","List","from","only","1","framework",">",">",">","client.list_deployed_models","(","``","text-generation-inference","''",")","{","'text-generation","'",":","[","'bigcode\/starcoder","'",",","'meta-llama\/Llama-2-70b-chat-hf","'",",","...","]",",","...","}","``","`"]
code: def list_deployed_models(
      self,
      frameworks: Union[None, str, Literal["all"], List[str]] = None,
  ) -> Dict[str, List[str]]:
      """
      List models currently deployed on the Inference API service.
  
      This helper checks deployed models framework by framework. By default, it will check the 4 main frameworks that
      are supported and account for 95% of the hosted models. However, if you want a complete list of models you can
      specify `frameworks="all"` as input. Alternatively, if you know before-hand which framework you are interested
      in, you can also restrict to search to this one (e.g. `frameworks="text-generation-inference"`). The more
      frameworks are checked, the more time it will take.
  
      <Tip>
  
      This endpoint is mostly useful for discoverability. If you already know which model you want to use and want to
      check its availability, you can directly use [`~InferenceClient.get_model_status`].
  
      </Tip>
  
      Args:
          frameworks (`Literal["all"]` or `List[str]` or `str`, *optional*):
              The frameworks to filter on. By default only a subset of the available frameworks are tested. If set to
              "all", all available frameworks will be tested. It is also possible to provide a single framework or a
              custom set of frameworks to check.
  
      Returns:
          `Dict[str, List[str]]`: A dictionary mapping task names to a sorted list of model IDs.
  
      Example:
      ```python
      >>> from huggingface_hub import InferenceClient
      >>> client = InferenceClient()
  
      # Discover zero-shot-classification models currently deployed
      >>> models = client.list_deployed_models()
      >>> models["zero-shot-classification"]
      ['Narsil/deberta-large-mnli-zero-cls', 'facebook/bart-large-mnli', ...]
  
      # List from only 1 framework
      >>> client.list_deployed_models("text-generation-inference")
      {'text-generation': ['bigcode/starcoder', 'meta-llama/Llama-2-70b-chat-hf', ...], ...}
      ```
      """
      # Resolve which frameworks to check
      if frameworks is None:
          frameworks = MAIN_INFERENCE_API_FRAMEWORKS
      elif frameworks == "all":
          frameworks = ALL_INFERENCE_API_FRAMEWORKS
      elif isinstance(frameworks, str):
          frameworks = [frameworks]
      frameworks = list(set(frameworks))
  
      # Fetch them iteratively
      models_by_task: Dict[str, List[str]] = {}
  
      def _unpack_response(framework: str, items: List[Dict]) -> None:
          for model in items:
              if framework == "sentence-transformers":
                  # Model running with the `sentence-transformers` framework can work with both tasks even if not
                  # branded as such in the API response
                  models_by_task.setdefault(
                      "feature-extraction", []
                  ).append(model["model_id"])
                  models_by_task.setdefault(
                      "sentence-similarity", []
                  ).append(model["model_id"])
              else:
                  models_by_task.setdefault(model["task"], []).append(
                      model["model_id"]
                  )
  
      for framework in frameworks:
          response = get_session().get(
              f"{INFERENCE_ENDPOINT}/framework/{framework}",
              headers=self.headers,
          )
          hf_raise_for_status(response)
          _unpack_response(framework, response.json())
  
      # Sort alphabetically for discoverability and return
      for task, models in models_by_task.items():
          models_by_task[task] = sorted(
              set(models), key=lambda x: x.lower()
          )
      return models_by_task
  
imports: import logging
  import time
  import warnings
  from dataclasses import asdict
  from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Literal, Optional, Union, overload
  from requests import HTTPError
  from requests.structures import CaseInsensitiveDict
  from huggingface_hub.constants import ALL_INFERENCE_API_FRAMEWORKS, INFERENCE_ENDPOINT, MAIN_INFERENCE_API_FRAMEWORKS
  from huggingface_hub.inference._common import TASKS_EXPECTING_IMAGES, ContentT, InferenceTimeoutError, ModelStatus, _b64_encode, _b64_to_image, _bytes_to_dict, _bytes_to_image, _bytes_to_list, _fetch_recommended_models, _import_numpy, _is_tgi_server, _open_as_binary, _set_as_non_tgi, _stream_text_generation_response
  from huggingface_hub.inference._text_generation import TextGenerationParameters, TextGenerationRequest, TextGenerationResponse, TextGenerationStreamResponse, raise_text_generation_error
  from huggingface_hub.inference._types import ClassificationOutput, ConversationalOutput, FillMaskOutput, ImageSegmentationOutput, ObjectDetectionOutput, QuestionAnsweringOutput, TableQuestionAnsweringOutput, TokenClassificationOutput
  from huggingface_hub.utils import BadRequestError, build_hf_headers, get_session, hf_raise_for_status
label_desc: Use image node_id 17 for calling the InferenceClient obj's underlying member method code with example usage: obj.list_deployed_models(frameworks) and returns: models_by_task