diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-09-08 12:17:26 +0300 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-09-08 12:17:26 +0300 |
commit | 3a4c6d9ef587354210155ba81e8de7d2ffc3f768 (patch) | |
tree | 3ea342de24260e7778c727b40ae9207849282fcc /webui.py | |
parent | a196c45f15dc088e7162476729cf3bf28b0b3d73 (diff) |
add webui() function for more simple cell in the notebook
Diffstat (limited to 'webui.py')
-rw-r--r-- | webui.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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()
|