Spaces:
Sleeping
Sleeping
GuysRGithub
commited on
Commit
·
02c56b0
1
Parent(s):
fb2ccc3
Update
Browse files
app.py
CHANGED
@@ -22,8 +22,6 @@ map_words = {
|
|
22 |
"Hi,": "",
|
23 |
"Hello": "",
|
24 |
"Hi": "",
|
25 |
-
"welcome to": "",
|
26 |
-
"thanks": "",
|
27 |
}
|
28 |
|
29 |
word_remove_sentence = [
|
@@ -64,9 +62,11 @@ PAGE_ACCESS_TOKEN = os.environ['PAGE_ACCESS_TOKEN']
|
|
64 |
def get_bot_response(message):
|
65 |
lang = detect(message)
|
66 |
model_use = model
|
67 |
-
|
|
|
68 |
model_use = vn_model
|
69 |
-
|
|
|
70 |
|
71 |
|
72 |
def verify_webhook(req):
|
@@ -156,7 +156,7 @@ def post_process(output):
|
|
156 |
for item in map_words.keys():
|
157 |
output = re.sub(item, map_words[item], output, re.I)
|
158 |
|
159 |
-
return
|
160 |
|
161 |
|
162 |
|
|
|
22 |
"Hi,": "",
|
23 |
"Hello": "",
|
24 |
"Hi": "",
|
|
|
|
|
25 |
}
|
26 |
|
27 |
word_remove_sentence = [
|
|
|
62 |
def get_bot_response(message):
|
63 |
lang = detect(message)
|
64 |
model_use = model
|
65 |
+
template = "Welcome to MedForRum chatbot service. %s. Thanks for asking on MedForum."
|
66 |
+
if lang == "vi":
|
67 |
model_use = vn_model
|
68 |
+
template = "Chào mừng bạn đến với dịch vụ MedForRum chatbot. %s. Cảm ơn bạn đã sử dụng MedForum."
|
69 |
+
return template % post_process(generate_summary(message, model_use)[1][0])
|
70 |
|
71 |
|
72 |
def verify_webhook(req):
|
|
|
156 |
for item in map_words.keys():
|
157 |
output = re.sub(item, map_words[item], output, re.I)
|
158 |
|
159 |
+
return textwrap.fill(textwrap.dedent(output).strip(), width=120)
|
160 |
|
161 |
|
162 |
|