Fixed errors when post-processing models aren't installed

Fixes #1522, #1604
This commit is contained in:
fezeral 2022-11-01 17:26:47 +10:30
parent d8e61a5cd3
commit 10b66cc2b9
4 changed files with 15 additions and 3 deletions

View File

@ -545,7 +545,9 @@ def layout():
upscaling_method_list.append("LDSR")
st.session_state["upscaling_method"] = st.selectbox("Upscaling Method", upscaling_method_list,
index=upscaling_method_list.index(st.session_state['defaults'].general.upscaling_method))
index=upscaling_method_list.index(st.session_state['defaults'].general.upscaling_method)
if st.session_state['defaults'].general.upscaling_method in upscaling_method_list
else 0)
if st.session_state["RealESRGAN_available"]:
with st.expander("RealESRGAN"):

View File

@ -2010,6 +2010,8 @@ def GFPGAN_available():
st.session_state["GFPGAN_available"] = True
else:
st.session_state["GFPGAN_available"] = False
st.session_state["use_GFPGAN"] = False
st.session_state["GFPGAN_model"] = "GFPGANv1.4"
#
def RealESRGAN_available():
@ -2028,6 +2030,8 @@ def RealESRGAN_available():
st.session_state["RealESRGAN_available"] = True
else:
st.session_state["RealESRGAN_available"] = False
st.session_state["use_RealESRGAN"] = False
st.session_state["RealESRGAN_model"] = "RealESRGAN_x4plus"
#
def LDSR_available():
#with server_state_lock["RealESRGAN_models"]:
@ -2048,6 +2052,8 @@ def LDSR_available():
st.session_state["LDSR_available"] = True
else:
st.session_state["LDSR_available"] = False
st.session_state["use_LDSR"] = False
st.session_state["LDSR_model"] = "model"

View File

@ -570,7 +570,9 @@ def layout():
#print (st.session_state["RealESRGAN_available"])
st.session_state["upscaling_method"] = st.selectbox("Upscaling Method", upscaling_method_list,
index=upscaling_method_list.index(str(st.session_state['defaults'].general.upscaling_method)))
index=upscaling_method_list.index(st.session_state['defaults'].general.upscaling_method)
if st.session_state['defaults'].general.upscaling_method in upscaling_method_list
else 0)
if st.session_state["RealESRGAN_available"]:
with st.expander("RealESRGAN"):

View File

@ -1788,7 +1788,9 @@ def layout():
upscaling_method_list.append("LDSR")
st.session_state["upscaling_method"] = st.selectbox("Upscaling Method", upscaling_method_list,
index=upscaling_method_list.index(st.session_state['defaults'].general.upscaling_method))
index=upscaling_method_list.index(st.session_state['defaults'].general.upscaling_method)
if st.session_state['defaults'].general.upscaling_method in upscaling_method_list
else 0)
if st.session_state["RealESRGAN_available"]:
with st.expander("RealESRGAN"):