Manofem commited on
Commit
47293f5
·
verified ·
1 Parent(s): f1d2654

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -15,14 +15,16 @@ def correct_words(text):
15
 
16
  def generate_response(message):
17
  global history
18
- for text in llm.generate(message):
19
- response = ''.join(text)
20
- time.sleep(0.1)
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)