-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
39 lines (32 loc) · 983 Bytes
/
Copy pathmain.py
File metadata and controls
39 lines (32 loc) · 983 Bytes
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
import asyncio
import threading
from src.utils import setup_logging
from src.memory import MemoryManager
from src.trainer import Trainer
from src.gui import App
from src.web_dashboard import WebDashboard
from src.config import config
main_loop = None
async def run_web(dashboard: WebDashboard):
await dashboard.start()
def start_asyncio():
global main_loop
main_loop = asyncio.new_event_loop()
asyncio.set_event_loop(main_loop)
memory = MemoryManager()
trainer = Trainer(memory)
dashboard = WebDashboard(trainer, port=config.web_dashboard_port)
main_loop.create_task(run_web(dashboard))
main_loop.run_forever()
def main():
setup_logging()
threading.Thread(target=start_asyncio, daemon=True).start()
import time
while main_loop is None: time.sleep(0.1)
memory = MemoryManager()
trainer = Trainer(memory)
app = App(trainer, memory)
app.setup_tray()
app.mainloop()
if __name__ == "__main__":
main()