-
Notifications
You must be signed in to change notification settings - Fork 31
/
webuisrv.py
30 lines (27 loc) · 959 Bytes
/
webuisrv.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
import multiprocessing as mp
import subprocess
from WebUI.configs import (WEBUI_SERVER)
class InnerLlmAIRobotWebUIServer():
def __init__(self):
super(InnerLlmAIRobotWebUIServer, self).__init__()
def launch(self, started_event: mp.Event = None, run_mode: str = None):
host = WEBUI_SERVER["host"]
port = WEBUI_SERVER["port"]
if host == "0.0.0.0":
host = "localhost"
cmd = ["streamlit", "run", "webui.py",
"--server.address", host,
"--server.port", str(port),
"--theme.base", "light",
"--theme.primaryColor", "#165dff",
"--theme.secondaryBackgroundColor", "#f5f5f5",
"--theme.textColor", "#000000",
]
if run_mode == "lite":
cmd += [
"--",
"lite",
]
p = subprocess.Popen(cmd)
started_event.set()
p.wait()