Hi! I’m working on a book recommendation system based on a LDA model and want to show the book options on one page. Right now I’m using st.image() and passing the list of images which comes from a column in the dataframe, and it looks like this:
st.image(filteredImages, width=150, caption=caption)
I’m able to set the width but not the height, so all of them have different heights. I tried using the pillow library to resize each image but the run time increases by a lot and I don’t get the desired image quality:
for image in filteredImages:
r = requests.get(image)
img = Image.open(BytesIO(r.content))
resizedImg = img.resize((225, 325), Image.ANTIALIAS)
resizedImages.append(resizedImg)
I also tried using a beta_container and I get something similar to my desired output but it’s repeating the same picture across the entire row:
with st.beta_container():
for col in st.beta_columns(4):
col.image(filteredImages, width=150)
Any thoughts on how I can get the same height across every picture in a grid?