-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.py
42 lines (31 loc) · 1.38 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
36
37
38
39
40
41
42
import os
from ai_avatar import AiAvatar
from logger import get_logger
import argparse
from terminal import CYAN, RESET
# create logger
LOG = get_logger(os.path.splitext(os.path.basename(__file__))[0])
# add arguments to specify input and output methods in chat mode
parser = argparse.ArgumentParser(description='Chose input / output methods to chat with Avatar')
parser.add_argument('--input', '-i', type=str, default=None, help='Input method')
parser.add_argument('--output', '-o', type=str, default=None, help='Output method')
args = parser.parse_args()
if __name__ == '__main__':
# create avatar instance
avatar = AiAvatar()
# start chat mode if arguments are provided
if args.input or args.output:
avatar.chat_with_avatar(input_method=args.input, output_method=args.output)
else:
print(f'\n{CYAN}# SELECT MODE #{RESET}')
choice = input(f'{CYAN}1.{RESET} Create Avatar Story\n{CYAN}2.{RESET} Chat with Avatar\n>> ')
while not choice in {'', '1', '2'}:
choice = input('>> ')
if choice == '1':
# create avatar story mode
LOG.info('Create Avatar Story mode selected')
avatar.create_avatar_story()
elif choice == '2':
# chat with avatar mode
LOG.info('Chat With Avatar mode selected')
avatar.chat_with_avatar()