def METHOD_NAME(headless=False):
    with gr.Tab('Group Images'):
        gr.Markdown(
            'This utility will group images in a folder based on their aspect ratio.'
        )
        with gr.Row():
            input_folder = gr.Textbox(
                label='Input folder',
                placeholder='Directory containing the images to group',
                interactive=True,
            )
            button_input_folder = gr.Button(
                '📂', elem_id='open_folder_small', visible=(not headless)
            )
            button_input_folder.click(
                get_folder_path,
                outputs=input_folder,
                show_progress=False,
            )
            output_folder = gr.Textbox(
                label='Output folder',
                placeholder='Directory where the grouped images will be stored',
                interactive=True,
            )
            button_output_folder = gr.Button(
                '📂', elem_id='open_folder_small', visible=(not headless)
            )
            button_output_folder.click(
                get_folder_path,
                outputs=output_folder,
                show_progress=False,
            )
        with gr.Row():
            group_size = gr.Slider(
                label='Group size',
                info='Number of images to group together',
                value='4',
                minimum=1,
                maximum=64,
                step=1,
                interactive=True,
            )
            include_subfolders = gr.Checkbox(
                label='Include Subfolders',
                value=False,
                info='Include images in subfolders as well',
            )
            do_not_copy_other_files = gr.Checkbox(
                label='Do not copy other files',
                value=False,
                info='Do not copy other files in the input folder to the output folder',
            )
            generate_captions = gr.Checkbox(
                label='Generate Captions',
                value=False,
                info='Generate caption files for the grouped images based on their folder name',
            )
            caption_ext = gr.Textbox(
                label='Caption Extension',
                placeholder='Caption file extension (e.g., .txt)',
                value='.txt',
                interactive=True,
            )
        group_images_button = gr.Button('Group images')
        group_images_button.click(
            group_images,
            inputs=[
                input_folder,
                output_folder,
                group_size,
                include_subfolders,
                do_not_copy_other_files,
                generate_captions,
                caption_ext,
            ],
            show_progress=False,
        )