fix: division by zero, inefficient preview check (#1230)

This commit is contained in:
Thomas Mello 2022-09-19 21:05:18 +03:00 committed by GitHub
parent 68118fe0f4
commit 3705f296c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -817,7 +817,10 @@ def generation_callback(img, i=0):
except TypeError:
pass
if i % int(st.session_state.update_preview_frequency) == 0 and st.session_state.update_preview and i > 0:
if st.session_state.update_preview and\
int(st.session_state.update_preview_frequency) > 0 and\
i % int(st.session_state.update_preview_frequency) == 0 and\
i > 0:
#print (img)
#print (type(img))
# The following lines will convert the tensor we got on img to an actual image we can render on the UI.