This repository has been archived by the owner. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
94 lines (78 loc) · 1.74 KB
/
tasks.py
File metadata and controls
94 lines (78 loc) · 1.74 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import os
import platform
from invoke import task
from functools import wraps
import rasa_plus
# Parameterizing tasks with invoke
# https://docs.pyinvoke.org/en/0.11.1/getting_started.html#parameterizing-tasks
@task
def b(c):
"""
Formats code according to PEP8's pattern
"""
c.run("black actions.py tasks.py")
@task
def t(c):
"""
Train Rasa bot
"""
c.run("rasa_plus unify-domain")
if platform.system() != "Windows":
c.run(f"rasa train", pty=True)
else:
c.run(f"rasa train")
@task
def s(c):
"""
Rasa shell
"""
if platform.system() != "Windows":
c.run(f"rasa shell", pty=True)
else:
c.run(f"rasa shell")
@task
def sh(c):
"""
Rasa shell and server
"""
if platform.system() != "Windows":
c.run(f"rasa run actions & rasa shell", pty=True)
else:
c.run(f"rasa run actions & rasa shell")
@task
def sv(c):
""" Start Rasa server """
if platform.system() != "Windows":
c.run(f"rasa run actions", pty=True)
else:
c.run(f"rasa run actions")
@task
def stop(c):
"""
Stop Rasa server
"""
if platform.system() != "Windows":
c.run("pkill -f rasa", pty=True)
print("Rasa server stopped.")
else:
# hope it works ok for windows :(
c.run("tskill -f rasa")
print("Rasa server stopped.")
@task
def dm(c):
"""
Remove all models on models folder
"""
if platform.system() != "Windows":
c.run("rm -f models/*", pty=True)
print("All model files removed.")
else:
c.run("rd /s /q models")
print("All model files removed.")
@task
def dt(c):
"""
Remove all models on models folder and retrain
"""
dm(c)
t(c)