Update app.py
Browse files
app.py
CHANGED
|
@@ -15,14 +15,16 @@ def correct_words(text):
|
|
| 15 |
|
| 16 |
def generate_response(message):
|
| 17 |
global history
|
| 18 |
-
for
|
| 19 |
-
response =
|
| 20 |
-
time.sleep(
|
| 21 |
corrected_response = correct_words(response)
|
| 22 |
history.append(corrected_response)
|
| 23 |
yield ' '.join(history)
|
| 24 |
# Clear the history list after the last response
|
| 25 |
history = ["Chatbot:"]
|
|
|
|
|
|
|
| 26 |
|
| 27 |
def chatbot(message, history):
|
| 28 |
response_generator = generate_response(message)
|
|
|
|
| 15 |
|
| 16 |
def generate_response(message):
|
| 17 |
global history
|
| 18 |
+
for _ in range(2): # Assuming you want two responses, adjust as needed
|
| 19 |
+
response = llm.generate(message, max_length=50, num_return_sequences=1)[0]['generated_text']
|
| 20 |
+
time.sleep(2)
|
| 21 |
corrected_response = correct_words(response)
|
| 22 |
history.append(corrected_response)
|
| 23 |
yield ' '.join(history)
|
| 24 |
# Clear the history list after the last response
|
| 25 |
history = ["Chatbot:"]
|
| 26 |
+
# Clear the history list after the last response
|
| 27 |
+
history = ["Chatbot:"]
|
| 28 |
|
| 29 |
def chatbot(message, history):
|
| 30 |
response_generator = generate_response(message)
|