-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathmain.py
35 lines (28 loc) · 1.29 KB
/
main.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
from src.http.http_server import http_server
import traceback
from src.http.routes.routeable import routeable
from src.http.routes.mantella_route import mantella_route
from src.http.routes.stt_route import stt_route
import logging
import src.setup as setup
from src.ui.start_ui import StartUI
def main():
try:
config, language_info = setup.initialise(
config_file='config.ini',
logging_file='logging.log',
language_file='data/language_support.csv')
mantella_version = '0.13 Preview 2'
logging.log(24, f'\nMantella v{mantella_version}')
mantella_http_server = http_server()
should_debug_http = config.show_http_debug_messages
conversation = mantella_route(config, 'STT_SECRET_KEY.txt', 'IMAGE_SECRET_KEY.txt', 'GPT_SECRET_KEY.txt', language_info, should_debug_http)
stt = stt_route(config, 'STT_SECRET_KEY.txt', 'GPT_SECRET_KEY.txt', should_debug_http)
ui = StartUI(config)
routes: list[routeable] = [conversation, stt, ui]
mantella_http_server.start(int(config.port), routes, config.play_startup_sound, should_debug_http)
except Exception as e:
logging.error("".join(traceback.format_exception(e)))
input("Press Enter to exit.")
if __name__ == '__main__':
main()