Update app.py
Browse files
app.py
CHANGED
@@ -52,13 +52,13 @@ def add_emoji(response):
|
|
52 |
# Define the keywords and their corresponding keywords
|
53 |
def tran_shortform(response):
|
54 |
keyword_shortform_dict = {
|
55 |
-
"yolo
|
56 |
-
"lol
|
57 |
-
"nvm
|
58 |
-
"lmk
|
59 |
-
"btw
|
60 |
-
"dk
|
61 |
-
"idk
|
62 |
"π": "happy",
|
63 |
"π’": "sad",
|
64 |
"π": "sorry",
|
@@ -87,7 +87,7 @@ def add_shortform(response):
|
|
87 |
"tell me": "LMK",
|
88 |
"By the way": "BTW",
|
89 |
"don't know":"DK",
|
90 |
-
"
|
91 |
}
|
92 |
response= response.lower()
|
93 |
for keyword, st in keyword_shortform_dict.items():
|
@@ -157,17 +157,19 @@ def chatbot(text,name):
|
|
157 |
response=f"{response}"
|
158 |
|
159 |
|
160 |
-
|
161 |
# Add emojis to the response
|
162 |
response = add_emoji(response)
|
163 |
# Add short form to the response
|
164 |
response = add_shortform(response)
|
165 |
-
|
166 |
-
chat_history.append((text,response))
|
167 |
|
168 |
# output the standard response
|
169 |
if text.lower() in keyword_responses:
|
170 |
response = keyword_responses[text.lower()]
|
|
|
|
|
|
|
171 |
|
172 |
# If the input language was Chinese, translate the response back to Chinese
|
173 |
if is_chinese:
|
|
|
52 |
# Define the keywords and their corresponding keywords
|
53 |
def tran_shortform(response):
|
54 |
keyword_shortform_dict = {
|
55 |
+
"yolo": "You only live once",
|
56 |
+
"lol":"funny" ,
|
57 |
+
"nvm": "nevermind",
|
58 |
+
"lmk": "tell me",
|
59 |
+
"btw": "by the way",
|
60 |
+
"dk":"don't know",
|
61 |
+
"idk":"I don't know" ,
|
62 |
"π": "happy",
|
63 |
"π’": "sad",
|
64 |
"π": "sorry",
|
|
|
87 |
"tell me": "LMK",
|
88 |
"By the way": "BTW",
|
89 |
"don't know":"DK",
|
90 |
+
"i don't know":"IDK"
|
91 |
}
|
92 |
response= response.lower()
|
93 |
for keyword, st in keyword_shortform_dict.items():
|
|
|
157 |
response=f"{response}"
|
158 |
|
159 |
|
160 |
+
|
161 |
# Add emojis to the response
|
162 |
response = add_emoji(response)
|
163 |
# Add short form to the response
|
164 |
response = add_shortform(response)
|
165 |
+
|
|
|
166 |
|
167 |
# output the standard response
|
168 |
if text.lower() in keyword_responses:
|
169 |
response = keyword_responses[text.lower()]
|
170 |
+
|
171 |
+
# update history
|
172 |
+
chat_history.append((text,response))
|
173 |
|
174 |
# If the input language was Chinese, translate the response back to Chinese
|
175 |
if is_chinese:
|