Streamlit Image Caption Multiple Lines

Hi!
I want to have my image caption be printed on multiple lines.
I have a NxM dynamic grid of images, and I want each of them to have text below the image, on multiple lines.

This is my current code

def generate_grid(data):

    image_idx_to_display = 0
    while image_idx_to_display < len(data):
        for _ in range(len(data)):
            cols = st.columns(5)
            for each_col_num in range(5):
                if image_idx_to_display < len(data):
                    current_item = data.loc[image_idx_to_display]

                    caption_text = "Hi this is line 1 \n and this is line 2"
                    cols[each_col_num].image(current_item["image_location"],
                                             use_column_width=True, caption=caption_text)
                    image_idx_to_display += 1

Is there a way i can actually print this on multiple lines?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.