Skip to content

models module

Module to fetch information about models

get_model_class(model_id)

Returns the model class based on the string ID. Raises ValueError if the model ID is not found.

Source code in cropengine/models.py
def get_model_class(model_id):
    """
    Returns the model class based on the string ID.
    Raises ValueError if the model ID is not found.
    """
    if model_id in MODEL_CLASS_MAPPING:
        return MODEL_CLASS_MAPPING[model_id]
    else:
        valid_keys = list(MODEL_CLASS_MAPPING.keys())
        raise ValueError(
            f"Model ID '{model_id}' not found. Available models: {valid_keys}"
        )