@@ -0,0 +1,1738 @@
+import pathlib%0Aimport psutil%0Aimport subprocess%0Aimport tempfile%0Aimport torch%0Afrom shutil import which%0A%0Aclass ProcessManager:%0A    def __init__(self):%0A        self.ui_process = None%0A        self.wss_process = None%0A%0A    def check_if_ui_running(self):%0A        if not pathlib.Path(self.get_ui_tmp_file()).is_file():%0A            return False%0A        with open(self.get_ui_tmp_file(), 'r') as temp:%0A            pid = temp.read()%0A            try:%0A                if psutil.pid_exists(int(pid)):%0A                    return True%0A                else:%0A                    return False%0A            except ValueError:%0A                return False%0A%0A    def get_ui_tmp_file(self):%0A        path = pathlib.Path(tempfile.gettempdir()).joinpath(%22hypergan.pid%22).absolute()%0A        return path%0A%0A    def start_websocket_server(self):%0A        WebsocketServer()%0A%0A    def spawn_ui(self):%0A        electron_path = which(%22electron%22)%0A        if electron_path is None:%0A            print(%22Could not find electron. Please make sure that it is available with %60npm i -g electron%60%22)%0A%0A        if self.check_if_ui_running():%0A            print(%22Hypergan UI is already running.%22)%0A            return%0A%0A        ui_path = pathlib.Path(__file__).parent.parent.joinpath(%22ui%22).absolute()%0A        print(%22Starting electron app%22)%0A        popen = subprocess.Popen(%5Belectron_path, ui_path%5D, shell=False)%0A        with open(self.get_ui_tmp_file(), 'w') as temp:%0A            temp.write(str(popen.pid))%0A        self.ui_process = popen%0A        print(%22Electron app started%22)%0A%0A    def spawn_websocket_server(self):%0A        print(%22Starting websocket server%22)%0A        #self.wss_process = torch.multiprocessing.spawn(self.start_websocket_server, join=False)%0A        print(%22Websocket server started%22)%0A

add missing process manager