import json


def load_model_info(model_path):
    """Load model info from file.

    Args:
        model_path (string): the full path of where the model is located.

    Raises:
        ValueError: raise an error if the path is invalid.

    Returns:
        dict: the inputs / outputs info dict.
    """
    if model_path.endswith(".tflite"):
        info_path = model_path.split(".tflite")[0] + ".info"
    elif model_path.endswith(".h5"):
        info_path = model_path.split(".h5")[0] + ".info"
    else:
        raise ValueError("Invalid model path")
    with open(info_path, "r") as f:
        return json.load(f)