def read_lora_metadata(filename: str) -> str:
    """Read the metadata from the Lora given the path `filename`. Modified from `extensions-builtin/Lora/network.py`.

    Args:
        filename (str): the Lora file path.

    Returns:
        A string representing the metadata.
    """
    # Firstly, read the metadata of the Lora from the cache. If the Lora is added to the folder
    # after the SD Web UI launches, then read the Lora from the hard disk to get the metadata.
    try:
        name = os.path.splitext(os.path.basename(filename))[0]
        read_metadata = lambda filename: sd_models.read_metadata_from_safetensors(filename)
        # It will return None if the Lora file has not be cached before.
        metadata = cache.cached_data_for_file("safetensors-metadata", "lora/" + name, filename, read_metadata)

        return metadata
    except TypeError:
        metadata = sd_models.read_metadata_from_safetensors(filename)

        return metadata
    except Exception as e:
        errors.display(e, f"reading lora {filename}")
Read the metadata from the Lora given the path `filename`. Modified from `extensions-builtin/Lora/network.py`.

    Args:
        filename (str): the Lora file path.

    Returns:
        A string representing the metadata.
    
scripts/sdwebui.py