docstr: Get all available fastdeploy models from hub server.
docstr_tok: ["Get","all","available","fastdeploy","models","from","hub","server","."]
code: def get_pretrain_model_list(self):
      """
      Get all available fastdeploy models from hub server.
      """
      res = requests.get(
          "http://paddlepaddle.org.cn/paddlehub/fastdeploy_listmodels"
      )
      result = res.json()
      if result["status"] != 0:
          raise RuntimeError(
              "Failed to get pre-trained model list from hub server."
          )
      else:
          data = result["data"]
          model_list = {}
          for category, models in data.items():
              if category not in model_list:
                  model_list[category] = set()
              for model in models:
                  model_list[category].add(model["name"])
          # adapt data format for frontend
          models_info = []
          for category, model_names in model_list.items():
              models_info.append(
                  {"value": category, "label": category, "children": []}
              )
              for model_name in sorted(model_names):
                  models_info[-1]["children"].append(
                      {"value": model_name, "label": model_name}
                  )
          return models_info
  
imports: import datetime
  import json
  import os
  import re
  import shutil
  import socket
  import time
  from multiprocessing import Process
  from pathlib import Path
  import requests
  from .fastdeploy_client.client_app import create_gradio_client_app
  from .fastdeploy_client.client_app import create_gradio_client_app_en
  from .fastdeploy_lib import analyse_config
  from .fastdeploy_lib import check_process_zombie
  from .fastdeploy_lib import copy_config_file_to_default_config
  from .fastdeploy_lib import delete_files_for_process
  from .fastdeploy_lib import exchange_format_to_original_format
  from .fastdeploy_lib import generate_metric_table
  from .fastdeploy_lib import get_alive_fastdeploy_servers
  from .fastdeploy_lib import get_config_filenames_for_one_model
  from .fastdeploy_lib import get_config_for_one_model
  from .fastdeploy_lib import get_process_model_configuration
  from .fastdeploy_lib import get_process_output
  from .fastdeploy_lib import get_start_arguments
  from .fastdeploy_lib import json2pbtxt
  from .fastdeploy_lib import kill_process
  from .fastdeploy_lib import launch_process
  from .fastdeploy_lib import mark_pid_for_dead_process
  from .fastdeploy_lib import original_format_to_exchange_format
  from .fastdeploy_lib import validate_data
  from visualdl.server.api import gen_result
  from visualdl.server.api import result
  from visualdl.utils.dir import FASTDEPLOYSERVER_PATH
label_desc: Use image node_id 12 for calling the FastDeployServerApi obj's underlying member method code with example usage: obj.get_pretrain_model_list() and returns: models_info