forked from ddPn08/Radiata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebui.py
56 lines (42 loc) · 1.17 KB
/
webui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import time
if "--tensorrt" in os.environ.get("COMMANDLINE_ARGS", ""):
import tensorrt as trt
from lib.tensorrt.utilities import TRT_LOGGER
print(f"TensorRT version: {trt.__version__}")
trt.init_libnvinfer_plugins(TRT_LOGGER, "")
from api.events.common import (
PostAppLaunchEvent,
PostUICreateEvent,
PreAppLaunchEvent,
PreUICreateEvent,
)
from modules import config, model_manager, plugin_loader, ui
from modules.diffusion import networks
def pre_load():
config.init()
plugin_loader.load_plugins()
PreAppLaunchEvent.call_event()
networks.init()
model_manager.init()
def post_load():
PostAppLaunchEvent.call_event()
def wait_on_server():
while 1:
time.sleep(0.5)
def webui():
pre_load()
PreUICreateEvent.call_event()
app = ui.create_ui()
PostUICreateEvent.call_event(PostUICreateEvent(app=app))
app.queue(64)
app, local_url, share_url = app.launch(
server_name=config.get("host"),
server_port=config.get("port"),
share=config.get("share"),
prevent_thread_lock=True,
)
post_load()
wait_on_server()
if __name__ == "__main__":
webui()