aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-06 05:54:11 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-09-06 05:54:11 +0000
commitbeece7d85cdcf160a0dc0ba05721d64f6afc867a (patch)
tree82c28e3e67d45df9b4bab274bf9a064fa64e97e7
parent4cb47bbf876d6f3ce84bbf4d1668912524a023de (diff)
downloadstable-diffusion-webui-gfx803-beece7d85cdcf160a0dc0ba05721d64f6afc867a.tar.gz
stable-diffusion-webui-gfx803-beece7d85cdcf160a0dc0ba05721d64f6afc867a.tar.bz2
stable-diffusion-webui-gfx803-beece7d85cdcf160a0dc0ba05721d64f6afc867a.zip
allow import as library for #72
-rw-r--r--webui.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/webui.py b/webui.py
index e703b343..f1fb506f 100644
--- a/webui.py
+++ b/webui.py
@@ -160,20 +160,20 @@ modules.sd_hijack.model_hijack.hijack(shared.sd_model)
modules.scripts.load_scripts(os.path.join(script_path, "scripts"))
+if __name__ == "__main__":
+ # make the program just exit at ctrl+c without waiting for anything
+ def sigint_handler(sig, frame):
+ print(f'Interrupted with singal {sig} in {frame}')
+ os._exit(0)
-# make the program just exit at ctrl+c without waiting for anything
-def sigint_handler(sig, frame):
- print(f'Interrupted with singal {sig} in {frame}')
- os._exit(0)
+ signal.signal(signal.SIGINT, sigint_handler)
-signal.signal(signal.SIGINT, sigint_handler)
+ demo = modules.ui.create_ui(
+ txt2img=wrap_gradio_gpu_call(modules.txt2img.txt2img),
+ img2img=wrap_gradio_gpu_call(modules.img2img.img2img),
+ run_extras=wrap_gradio_gpu_call(run_extras),
+ run_pnginfo=run_pnginfo
+ )
-demo = modules.ui.create_ui(
- txt2img=wrap_gradio_gpu_call(modules.txt2img.txt2img),
- img2img=wrap_gradio_gpu_call(modules.img2img.img2img),
- run_extras=wrap_gradio_gpu_call(run_extras),
- run_pnginfo=run_pnginfo
-)
-
-demo.launch(share=cmd_opts.share, server_name="0.0.0.0" if cmd_opts.listen else None)
+ demo.launch(share=cmd_opts.share, server_name="0.0.0.0" if cmd_opts.listen else None)