code: def convert_from_config(config):
      """Convert to hls4ml model based on the provided configuration.
  
      Arguments:
          config: A string containing the path to the YAML configuration file on
              the filesystem or a dict containing the parsed configuration.
  
      Returns:
          ModelGraph: hls4ml model.
      """
  
      if isinstance(config, str):
          yamlConfig = parse_yaml_config(config)
      else:
          yamlConfig = config
  
      model = None
      if "OnnxModel" in yamlConfig:
          if __onnx_enabled__:
              model = onnx_to_hls(yamlConfig)
          else:
              raise Exception("ONNX not found. Please install ONNX.")
      elif "PytorchModel" in yamlConfig:
          if __pytorch_enabled__:
              model = pytorch_to_hls(yamlConfig)
          else:
              raise Exception(
                  "PyTorch not found. Please install PyTorch."
              )
      else:
          model = keras_to_hls(yamlConfig)
  
      return model
  
imports: import importlib
  import os
  import warnings
  import yaml
  from hls4ml.converters.keras_to_hls import KerasFileReader
  from hls4ml.converters.keras_to_hls import KerasModelReader
  from hls4ml.converters.keras_to_hls import KerasReader
  from hls4ml.converters.keras_to_hls import get_supported_keras_layers
  from hls4ml.converters.keras_to_hls import parse_keras_model
  from hls4ml.converters.keras_to_hls import keras_to_hls, register_keras_layer_handler
  from hls4ml.model import ModelGraph
  from hls4ml.utils.config import create_config
  from hls4ml.utils.symbolic_utils import LUTFunction
label_desc: Use image node_id 2 for calling a global function with example usage: convert_from_config(config) and returns: model