mirror of
https://github.com/Sygil-Dev/sygil-webui.git
synced 2024-12-15 14:31:44 +03:00
Fixed the generate button needing to be clicked twice on the first run as the models would cause a rerun stopping the generation from starting right away and needing a second click on the generate button. (#1704)
This commit is contained in:
commit
d90c44c197
@ -29,7 +29,7 @@ streamlit==1.14.0
|
||||
streamlit-on-Hover-tabs==1.0.1
|
||||
streamlit-option-menu==0.3.2
|
||||
streamlit_nested_layout==0.1.1
|
||||
streamlit-server-state==0.14.2
|
||||
streamlit-server-state==0.15.0
|
||||
streamlit-tensorboard==0.0.2
|
||||
streamlit-elements==0.1.* # used for the draggable dashboard and new UI design (WIP)
|
||||
streamlit-ace==0.1.1 # used to replace the text area on the prompt and also for the code editor tool.
|
||||
|
@ -14,7 +14,7 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# base webui import and utils.
|
||||
from sd_utils import st, server_state, \
|
||||
from sd_utils import st, server_state, no_rerun, \
|
||||
generation_callback, process_images, KDiffusionSampler, \
|
||||
custom_models_available, RealESRGAN_available, GFPGAN_available, \
|
||||
LDSR_available, load_models, hc, seed_to_int, logger, \
|
||||
@ -694,11 +694,12 @@ def layout():
|
||||
#print("Loading models")
|
||||
# load the models when we hit the generate button for the first time, it wont be loaded after that so dont worry.
|
||||
with col3_img2img_layout:
|
||||
with hc.HyLoader('Loading Models...', hc.Loaders.standard_loaders,index=[0]):
|
||||
load_models(use_LDSR=st.session_state["use_LDSR"], LDSR_model=st.session_state["LDSR_model"],
|
||||
use_GFPGAN=st.session_state["use_GFPGAN"], GFPGAN_model=st.session_state["GFPGAN_model"] ,
|
||||
use_RealESRGAN=st.session_state["use_RealESRGAN"], RealESRGAN_model=st.session_state["RealESRGAN_model"],
|
||||
CustomModel_available=server_state["CustomModel_available"], custom_model=st.session_state["custom_model"])
|
||||
with no_rerun:
|
||||
with hc.HyLoader('Loading Models...', hc.Loaders.standard_loaders,index=[0]):
|
||||
load_models(use_LDSR=st.session_state["use_LDSR"], LDSR_model=st.session_state["LDSR_model"],
|
||||
use_GFPGAN=st.session_state["use_GFPGAN"], GFPGAN_model=st.session_state["GFPGAN_model"] ,
|
||||
use_RealESRGAN=st.session_state["use_RealESRGAN"], RealESRGAN_model=st.session_state["RealESRGAN_model"],
|
||||
CustomModel_available=server_state["CustomModel_available"], custom_model=st.session_state["custom_model"])
|
||||
|
||||
if uploaded_images:
|
||||
#image = Image.fromarray(image).convert('RGBA')
|
||||
|
@ -22,7 +22,7 @@ from streamlit.runtime.scriptrunner import StopException
|
||||
#from streamlit.runtime.scriptrunner import script_run_context
|
||||
|
||||
#streamlit components section
|
||||
from streamlit_server_state import server_state, server_state_lock
|
||||
from streamlit_server_state import server_state, server_state_lock, no_rerun
|
||||
import hydralit_components as hc
|
||||
from hydralit import HydraHeadApp
|
||||
import streamlit_nested_layout
|
||||
|
@ -14,7 +14,7 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# base webui import and utils.
|
||||
from sd_utils import st, MemUsageMonitor, server_state, \
|
||||
from sd_utils import st, MemUsageMonitor, server_state, no_rerun, \
|
||||
get_next_sequence_number, check_prompt_length, torch_gc, \
|
||||
save_sample, generation_callback, process_images, \
|
||||
KDiffusionSampler, \
|
||||
@ -431,7 +431,7 @@ def layout():
|
||||
if st.session_state['defaults'].admin.global_negative_prompt:
|
||||
prompt += f"### {st.session_state['defaults'].admin.global_negative_prompt}"
|
||||
|
||||
print(prompt)
|
||||
#print(prompt)
|
||||
|
||||
# creating the page layout using columns
|
||||
col1, col2, col3 = st.columns([2,5,2], gap="large")
|
||||
@ -658,12 +658,13 @@ def layout():
|
||||
if generate_button:
|
||||
|
||||
with col2:
|
||||
if not use_stable_horde:
|
||||
with hc.HyLoader('Loading Models...', hc.Loaders.standard_loaders,index=[0]):
|
||||
load_models(use_LDSR=st.session_state["use_LDSR"], LDSR_model=st.session_state["LDSR_model"],
|
||||
use_GFPGAN=st.session_state["use_GFPGAN"], GFPGAN_model=st.session_state["GFPGAN_model"] ,
|
||||
use_RealESRGAN=st.session_state["use_RealESRGAN"], RealESRGAN_model=st.session_state["RealESRGAN_model"],
|
||||
CustomModel_available=server_state["CustomModel_available"], custom_model=st.session_state["custom_model"])
|
||||
with no_rerun:
|
||||
if not use_stable_horde:
|
||||
with hc.HyLoader('Loading Models...', hc.Loaders.standard_loaders,index=[0]):
|
||||
load_models(use_LDSR=st.session_state["use_LDSR"], LDSR_model=st.session_state["LDSR_model"],
|
||||
use_GFPGAN=st.session_state["use_GFPGAN"], GFPGAN_model=st.session_state["GFPGAN_model"] ,
|
||||
use_RealESRGAN=st.session_state["use_RealESRGAN"], RealESRGAN_model=st.session_state["RealESRGAN_model"],
|
||||
CustomModel_available=server_state["CustomModel_available"], custom_model=st.session_state["custom_model"])
|
||||
|
||||
#print(st.session_state['use_RealESRGAN'])
|
||||
#print(st.session_state['use_LDSR'])
|
||||
|
@ -21,7 +21,7 @@ https://github.com/nateraw/stable-diffusion-videos
|
||||
repo and the original gist script from
|
||||
https://gist.github.com/karpathy/00103b0037c5aaea32fe1da1af553355
|
||||
"""
|
||||
from sd_utils import st, MemUsageMonitor, server_state, torch_gc, \
|
||||
from sd_utils import st, MemUsageMonitor, server_state, no_rerun, torch_gc, \
|
||||
custom_models_available, RealESRGAN_available, GFPGAN_available, \
|
||||
LDSR_available, hc, seed_to_int, logger, slerp, optimize_update_preview_frequency, \
|
||||
load_learned_embed_in_clip, load_GFPGAN, RealESRGANModel
|
||||
@ -1909,25 +1909,25 @@ def layout():
|
||||
#print("Loading models")
|
||||
# load the models when we hit the generate button for the first time, it wont be loaded after that so dont worry.
|
||||
#load_models(False, st.session_state["use_GFPGAN"], True, st.session_state["RealESRGAN_model"])
|
||||
|
||||
if st.session_state["use_GFPGAN"]:
|
||||
if "GFPGAN" in server_state:
|
||||
logger.info("GFPGAN already loaded")
|
||||
with no_rerun:
|
||||
if st.session_state["use_GFPGAN"]:
|
||||
if "GFPGAN" in server_state:
|
||||
logger.info("GFPGAN already loaded")
|
||||
else:
|
||||
with col2:
|
||||
with hc.HyLoader('Loading Models...', hc.Loaders.standard_loaders,index=[0]):
|
||||
# Load GFPGAN
|
||||
if os.path.exists(st.session_state["defaults"].general.GFPGAN_dir):
|
||||
try:
|
||||
load_GFPGAN()
|
||||
logger.info("Loaded GFPGAN")
|
||||
except Exception:
|
||||
import traceback
|
||||
logger.error("Error loading GFPGAN:", file=sys.stderr)
|
||||
logger.error(traceback.format_exc(), file=sys.stderr)
|
||||
else:
|
||||
with col2:
|
||||
with hc.HyLoader('Loading Models...', hc.Loaders.standard_loaders,index=[0]):
|
||||
# Load GFPGAN
|
||||
if os.path.exists(st.session_state["defaults"].general.GFPGAN_dir):
|
||||
try:
|
||||
load_GFPGAN()
|
||||
logger.info("Loaded GFPGAN")
|
||||
except Exception:
|
||||
import traceback
|
||||
logger.error("Error loading GFPGAN:", file=sys.stderr)
|
||||
logger.error(traceback.format_exc(), file=sys.stderr)
|
||||
else:
|
||||
if "GFPGAN" in server_state:
|
||||
del server_state["GFPGAN"]
|
||||
if "GFPGAN" in server_state:
|
||||
del server_state["GFPGAN"]
|
||||
|
||||
#try:
|
||||
# run video generation
|
||||
|
Loading…
Reference in New Issue
Block a user