deeksonparlma
commited on
Commit
·
fa80c7a
1
Parent(s):
45bf0b2
refactor
Browse files
app.py
CHANGED
|
@@ -46,7 +46,6 @@ def bag_of_words(s, words):
|
|
| 46 |
|
| 47 |
|
| 48 |
def chat(message):
|
| 49 |
-
history = history or []
|
| 50 |
message = message.lower()
|
| 51 |
results = model.predict([bag_of_words(message, words)])
|
| 52 |
results_index = np.argmax(results)
|
|
@@ -55,12 +54,8 @@ def chat(message):
|
|
| 55 |
for tg in data["intents"]:
|
| 56 |
if tg['tag'] == tag:
|
| 57 |
responses = tg['responses']
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
response = random.choice(responses)
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
return str(response)
|
| 64 |
|
| 65 |
# history.append((message, response))
|
| 66 |
# return history, history
|
|
|
|
| 46 |
|
| 47 |
|
| 48 |
def chat(message):
|
|
|
|
| 49 |
message = message.lower()
|
| 50 |
results = model.predict([bag_of_words(message, words)])
|
| 51 |
results_index = np.argmax(results)
|
|
|
|
| 54 |
for tg in data["intents"]:
|
| 55 |
if tg['tag'] == tag:
|
| 56 |
responses = tg['responses']
|
| 57 |
+
# return responses
|
| 58 |
+
return random.choice(responses)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
# history.append((message, response))
|
| 61 |
# return history, history
|