add webui() function for more simple cell in the notebook

This commit is contained in:
AUTOMATIC 2022-09-08 12:17:26 +03:00
parent a196c45f15
commit 3a4c6d9ef5

View File

@ -43,6 +43,7 @@ def load_model_from_config(config, ckpt, verbose=False):
if "global_step" in pl_sd:
print(f"Global Step: {pl_sd['global_step']}")
sd = pl_sd["state_dict"]
model = instantiate_from_config(config.model)
m, u = model.load_state_dict(sd, strict=False)
if len(m) > 0 and verbose:
@ -175,13 +176,13 @@ modules.sd_hijack.model_hijack.hijack(shared.sd_model)
modules.scripts.load_scripts(os.path.join(script_path, "scripts"))
if __name__ == "__main__":
def webui():
# make the program just exit at ctrl+c without waiting for anything
def sigint_handler(sig, frame):
print(f'Interrupted with signal {sig} in {frame}')
os._exit(0)
signal.signal(signal.SIGINT, sigint_handler)
demo = modules.ui.create_ui(
@ -192,3 +193,7 @@ if __name__ == "__main__":
)
demo.launch(share=cmd_opts.share, server_name="0.0.0.0" if cmd_opts.listen else None, server_port=cmd_opts.port)
if __name__ == "__main__":
webui()