code: def create_api_call(logdir, model, cache_timeout):
      api = Api(logdir, model, cache_timeout)
      routes = {
          "components": (api.components, []),
          "runs": (api.runs, []),
          "graph_runs": (api.graph_runs, []),
          "tags": (api.tags, []),
          "logs": (api.logs, []),
          "scalar/tags": (api.scalar_tags, []),
          "scalars/tags": (api.scalars_tags, []),
          "image/tags": (api.image_tags, []),
          "text/tags": (api.text_tags, []),
          "audio/tags": (api.audio_tags, []),
          "embedding/tags": (api.embedding_tags, []),
          "histogram/tags": (api.histogram_tags, []),
          "pr-curve/tags": (api.pr_curve_tags, []),
          "roc-curve/tags": (api.roc_curve_tags, []),
          "scalar/list": (api.scalar_list, ["run", "tag"]),
          "scalars/list": (api.scalars_list, ["run", "tag", "sub_tag"]),
          "scalar/data": (api.scalar_data, ["run", "tag", "type"]),
          "scalars/data": (
              api.scalars_data,
              ["run", "tag", "sub_tag", "type"],
          ),
          "image/list": (api.image_list, ["run", "tag"]),
          "image/image": (api.image_image, ["run", "tag", "index"]),
          "text/list": (api.text_list, ["run", "tag"]),
          "text/text": (api.text_text, ["run", "tag", "index"]),
          "audio/list": (api.audio_list, ["run", "tag"]),
          "audio/audio": (api.audio_audio, ["run", "tag", "index"]),
          "embedding/embedding": (
              api.embedding_embedding,
              ["run", "tag", "reduction", "dimension"],
          ),
          "embedding/list": (api.embedding_list, []),
          "embedding/tensor": (api.embedding_tensor, ["name"]),
          "embedding/metadata": (api.embedding_metadata, ["name"]),
          "histogram/list": (api.histogram_list, ["run", "tag"]),
          "graph/graph": (
              api.graph_graph,
              ["run", "expand_all", "refresh"],
          ),
          "graph/static_graph": (api.graph_static_graph, []),
          "graph/upload": (api.graph_upload, []),
          "graph/search": (
              api.graph_search,
              ["run", "nodeid", "keep_state", "is_node"],
          ),
          "graph/get_all_nodes": (api.graph_get_all_nodes, ["run"]),
          "graph/manipulate": (
              api.graph_manipulate,
              ["run", "nodeid", "expand", "keep_state"],
          ),
          "pr-curve/list": (api.pr_curves_pr_curve, ["run", "tag"]),
          "roc-curve/list": (api.roc_curves_roc_curve, ["run", "tag"]),
          "pr-curve/steps": (api.pr_curves_steps, ["run"]),
          "roc-curve/steps": (api.roc_curves_steps, ["run"]),
          "hparams/importance": (api.hparam_importance, []),
          "hparams/data": (api.hparam_data, ["type"]),
          "hparams/indicators": (api.hparam_indicator, []),
          "hparams/list": (api.hparam_list, []),
          "hparams/metric": (api.hparam_metric, ["run", "metric"]),
          "component_tabs": (api.component_tabs, []),
      }
  
      def call(path: str, args):
          route = routes.get(path)
          if not route:
              return (
                  json.dumps(gen_result(status=1, msg="api not found")),
                  "application/json",
                  None,
              )
          method, call_arg_names = route
          call_args = [args.get(name) for name in call_arg_names]
          return method(*call_args)
  
      return call
  
imports: import functools
  import gzip
  import json
  import os
  from io import BytesIO
  from flask import request
  from visualdl import LogReader
  from visualdl.python.cache import MemCache
  from visualdl.reader.graph_reader import GraphReader
  from visualdl.server import lib
  from visualdl.server.client_manager import ClientManager
  from visualdl.server.log import logger
label_desc: Use image node_id 5 for calling a global function with example usage: create_api_call(logdir, model, cache_timeout) and returns: call, method, json,  str,  None