def trending_models_for_task()

in trending_deploy/models.py [0:0]


def trending_models_for_task(task: str, max_models_per_task: int = 200) -> List[Model]:
    """
    Fetches the trending models for a specific task.

    Args:
        task (str): The task for which to fetch trending models.
        max_models_per_task (int): The maximum number of models to fetch per task.

    Returns:
        List[Model]: A list of Model objects containing model information and viable instance.
    """
    models_to_consider: list[Model] = []
    trending_model_gen = trending_model_generator(task)
    try:
        for _ in trange(max_models_per_task, desc="Loading models", leave=False):
            models_to_consider.append(next(trending_model_gen))
    except StopIteration:
        pass
    return models_to_consider