add api() function to return webui() to how it was
This commit is contained in:
parent
71d42bb44b
commit
964b63c042
19
webui.py
19
webui.py
|
@ -87,10 +87,6 @@ def initialize():
|
||||||
shared.opts.onchange("sd_hypernetwork", wrap_queued_call(lambda: modules.hypernetworks.hypernetwork.load_hypernetwork(shared.opts.sd_hypernetwork)))
|
shared.opts.onchange("sd_hypernetwork", wrap_queued_call(lambda: modules.hypernetworks.hypernetwork.load_hypernetwork(shared.opts.sd_hypernetwork)))
|
||||||
shared.opts.onchange("sd_hypernetwork_strength", modules.hypernetworks.hypernetwork.apply_strength)
|
shared.opts.onchange("sd_hypernetwork_strength", modules.hypernetworks.hypernetwork.apply_strength)
|
||||||
|
|
||||||
|
|
||||||
def webui():
|
|
||||||
initialize()
|
|
||||||
|
|
||||||
# make the program just exit at ctrl+c without waiting for anything
|
# make the program just exit at ctrl+c without waiting for anything
|
||||||
def sigint_handler(sig, frame):
|
def sigint_handler(sig, frame):
|
||||||
print(f'Interrupted with signal {sig} in {frame}')
|
print(f'Interrupted with signal {sig} in {frame}')
|
||||||
|
@ -98,14 +94,18 @@ def webui():
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, sigint_handler)
|
signal.signal(signal.SIGINT, sigint_handler)
|
||||||
|
|
||||||
if cmd_opts.api:
|
|
||||||
|
def api()
|
||||||
|
initialize()
|
||||||
|
|
||||||
from modules.api.api import Api
|
from modules.api.api import Api
|
||||||
api = Api()
|
api = Api()
|
||||||
|
api.launch(server_name="0.0.0.0" if cmd_opts.listen else "127.0.0.1", port=cmd_opts.port if cmd_opts.port else 7861)
|
||||||
|
|
||||||
api.launch(server_name="0.0.0.0" if cmd_opts.listen else "127.0.0.1",
|
|
||||||
port=cmd_opts.port if cmd_opts.port else 7861)
|
|
||||||
|
|
||||||
else:
|
def webui():
|
||||||
|
initialize()
|
||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
|
|
||||||
demo = modules.ui.create_ui(wrap_gradio_gpu_call=wrap_gradio_gpu_call)
|
demo = modules.ui.create_ui(wrap_gradio_gpu_call=wrap_gradio_gpu_call)
|
||||||
|
@ -142,4 +142,7 @@ def webui():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
if cmd_opts.api:
|
||||||
|
api()
|
||||||
|
else:
|
||||||
webui()
|
webui()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user