def uninstall_requirements(params):
    """
    Uninstalls the requirements specified in the requirements.txt file of a given project.

    This function reads the requirements.txt file located in the project's directory,
    extracts the packages to be uninstalled, writes them to an uninstall.txt file,
    and then uses pip to uninstall those packages.

    Args:
        params (object): An object containing the project_name attribute, which specifies
                         the directory of the project.

    Returns:
        None
    """
    if os.path.exists(f"{params.project_name}/requirements.txt"):
        # read the requirements.txt
        uninstall_list = []
        with open(f"{params.project_name}/requirements.txt", "r", encoding="utf-8") as f:
            for line in f:
                if line.startswith("-"):
                    uninstall_list.append(line[1:])

        # create an uninstall.txt
        with open(f"{params.project_name}/uninstall.txt", "w", encoding="utf-8") as f:
            for line in uninstall_list:
                f.write(line)

        pipe = subprocess.Popen(
            [
                "pip",
                "uninstall",
                "-r",
                "uninstall.txt",
                "-y",
            ],
            cwd=params.project_name,
        )
        pipe.wait()
        logger.info("Requirements uninstalled.")
        return

    Uninstalls the requirements specified in the requirements.txt file of a given project.

    This function reads the requirements.txt file located in the project's directory,
    extracts the packages to be uninstalled, writes them to an uninstall.txt file,
    and then uses pip to uninstall those packages.

    Args:
        params (object): An object containing the project_name attribute, which specifies
                         the directory of the project.

    Returns:
        None
    
src/autotrain/trainers/generic/utils.py