-
Notifications
You must be signed in to change notification settings - Fork 0
/
interactive_gen.py
33 lines (26 loc) · 965 Bytes
/
interactive_gen.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
import signal
from argparse import ArgumentParser
from bot.model import CalendaBot
from twitter import Tweet
def main(args):
bot = CalendaBot(args)
name = input('Display name:\t')
username = input('Username:\t@')
tweet = Tweet('', username, name)
print('From now on, you can write your tweets to @Calend_AI')
while True:
tweet.text = input('> ')
if not tweet.text:
bot.interactive_set_args()
continue
answers = bot.reply_to(tweet, bot.cite)
for answer in answers:
print(f'@Calend_AI: {answer}')
print()
if __name__ == '__main__':
signal.signal(signal.SIGINT, lambda signum, frame: exit())
parser = ArgumentParser(description='Interactive generation of @Calend_AI\'s response tweets')
parser.add_argument('model_path')
parser.add_argument('config_file')
parser.add_argument('--blacklist', '-b', default=None)
main(parser.parse_args())