mirror of
https://github.com/sd-webui/stable-diffusion-webui.git
synced 2024-12-15 07:12:58 +03:00
Fix errors rendering galleries when there are not enough images to render
This commit is contained in:
parent
b4de6caf69
commit
8a25dcc332
@ -193,22 +193,17 @@ def layout():
|
||||
col3_cont = st.container()
|
||||
|
||||
#print (len(st.session_state['latestImages'][gallery_start_idx:gallery_end_idx]))
|
||||
images = st.session_state['latestImages'][gallery_start_idx:gallery_end_idx]
|
||||
|
||||
with col1_cont:
|
||||
with col1:
|
||||
st.image(st.session_state['latestImages'][gallery_start_idx:gallery_end_idx][0])
|
||||
st.image(st.session_state['latestImages'][gallery_start_idx:gallery_end_idx][3])
|
||||
st.image(st.session_state['latestImages'][gallery_start_idx:gallery_end_idx][6])
|
||||
[st.image(images[index]) for index in [0, 3, 6] if index < len(images)]
|
||||
with col2_cont:
|
||||
with col2:
|
||||
st.image(st.session_state['latestImages'][gallery_start_idx:gallery_end_idx][1])
|
||||
st.image(st.session_state['latestImages'][gallery_start_idx:gallery_end_idx][4])
|
||||
st.image(st.session_state['latestImages'][gallery_start_idx:gallery_end_idx][7])
|
||||
[st.image(images[index]) for index in [1, 4, 7] if index < len(images)]
|
||||
with col3_cont:
|
||||
with col3:
|
||||
st.image(st.session_state['latestImages'][gallery_start_idx:gallery_end_idx][2])
|
||||
st.image(st.session_state['latestImages'][gallery_start_idx:gallery_end_idx][5])
|
||||
st.image(st.session_state['latestImages'][gallery_start_idx:gallery_end_idx][8])
|
||||
[st.image(images[index]) for index in [2, 5, 8] if index < len(images)]
|
||||
|
||||
|
||||
st.session_state['historyTab'] = [history_tab,col1,col2,col3,placeholder,col1_cont,col2_cont,col3_cont]
|
||||
@ -223,4 +218,3 @@ def layout():
|
||||
#if st.button("Try it out"):
|
||||
#if the button is clicked, go to the gallery
|
||||
#st.experimental_rerun()
|
||||
|
@ -290,21 +290,16 @@ def layout():
|
||||
col1_cont = st.container()
|
||||
col2_cont = st.container()
|
||||
col3_cont = st.container()
|
||||
images = st.session_state['latestImages']
|
||||
with col1_cont:
|
||||
with col1:
|
||||
st.image(st.session_state['latestImages'][0])
|
||||
st.image(st.session_state['latestImages'][3])
|
||||
st.image(st.session_state['latestImages'][6])
|
||||
[st.image(images[index]) for index in [0, 3, 6] if index < len(images)]
|
||||
with col2_cont:
|
||||
with col2:
|
||||
st.image(st.session_state['latestImages'][1])
|
||||
st.image(st.session_state['latestImages'][4])
|
||||
st.image(st.session_state['latestImages'][7])
|
||||
[st.image(images[index]) for index in [1, 4, 7] if index < len(images)]
|
||||
with col3_cont:
|
||||
with col3:
|
||||
st.image(st.session_state['latestImages'][2])
|
||||
st.image(st.session_state['latestImages'][5])
|
||||
st.image(st.session_state['latestImages'][8])
|
||||
[st.image(images[index]) for index in [2, 5, 8] if index < len(images)]
|
||||
historyGallery = st.empty()
|
||||
|
||||
# check if output_images length is the same as seeds length
|
||||
|
Loading…
Reference in New Issue
Block a user