-
Notifications
You must be signed in to change notification settings - Fork 712
/
manage.py
executable file
·41 lines (32 loc) · 1.01 KB
/
manage.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
from flask_script import Manager
from app import create_app
app = create_app()
manager = Manager(app)
@manager.command
def migrate():
from app.agents.models import Bot
try:
# create default bot
bot = Bot()
bot.name = "default"
bot.save()
print("Created default bot")
except:
print("Default agent exists.. skipping..")
# import some default intents
from app.intents.controllers import import_json
json_file = open("examples/default_intents.json", "r+")
stories = import_json(json_file)
print("Imported {} Stories".format(len(stories)))
try:
print("Training models..")
from app.nlu.tasks import train_models
train_models()
print("Training models finished..")
except Exception as e:
e = str(e)
if e == "NO_DATA":
e = "load Data first into mongodb. Reffer Readme."
print("Could not train models..skipping.. (reason: {})".format(e))
if __name__ == "__main__":
manager.run()