Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,7 @@ def correct_words(text):
|
|
| 13 |
corrected_text = ' '.join(corrected_words)
|
| 14 |
return corrected_text
|
| 15 |
import asyncio
|
|
|
|
| 16 |
|
| 17 |
# ... (previous code)
|
| 18 |
|
|
@@ -20,7 +21,7 @@ async def generate_async(tokens):
|
|
| 20 |
for token in tokens:
|
| 21 |
yield token
|
| 22 |
|
| 23 |
-
def
|
| 24 |
global history
|
| 25 |
for _ in range(2):
|
| 26 |
tokens = [ord(char) for char in message]
|
|
@@ -31,7 +32,6 @@ def generate_response(message):
|
|
| 31 |
history.append(corrected_response)
|
| 32 |
yield ' '.join(history)
|
| 33 |
history = ["Chatbot:"]
|
| 34 |
-
history = ["Chatbot:"]
|
| 35 |
# Clear the history list after the last response
|
| 36 |
history = ["Chatbot:"]
|
| 37 |
def chatbot(message, history):
|
|
|
|
| 13 |
corrected_text = ' '.join(corrected_words)
|
| 14 |
return corrected_text
|
| 15 |
import asyncio
|
| 16 |
+
import asyncio
|
| 17 |
|
| 18 |
# ... (previous code)
|
| 19 |
|
|
|
|
| 21 |
for token in tokens:
|
| 22 |
yield token
|
| 23 |
|
| 24 |
+
async def generate_response_async(message):
|
| 25 |
global history
|
| 26 |
for _ in range(2):
|
| 27 |
tokens = [ord(char) for char in message]
|
|
|
|
| 32 |
history.append(corrected_response)
|
| 33 |
yield ' '.join(history)
|
| 34 |
history = ["Chatbot:"]
|
|
|
|
| 35 |
# Clear the history list after the last response
|
| 36 |
history = ["Chatbot:"]
|
| 37 |
def chatbot(message, history):
|