How to add images in the empty space

Summary

Hi, I would like to know if it possible to add images to the empty space (as marked in the image below). I would like to add a picture of lightning beside the answer. I’ve tried using st.columns but it doesn’t look clean since it displays the image and the answer side by side inside the bot response, so I want to know if it possible to display the image outside beside the answer text.

You can do something like:

import streamlit as st

# Create a two-column layout
col1, col2 = st.columns([3, 1]) # this will just call methods directly in the returned objects

# Inside the first column, add the answer text
with col1:
    st.write("Your answer goes here. You can format it as needed.")

# Inside the second column, add the image
with col2:
    st.image("path_to_your_image.png", caption="Lightning Image", use_column_width=True)

And whenever you dont need images you can just keep it blank, something like this structure:
image

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