Manofem commited on
Commit
55bafcf
·
verified ·
1 Parent(s): 4917dc3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -16,15 +16,14 @@ def correct_words(text):
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_beams=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)
 
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(tokens=message.split(), top_k=50, top_p=0.95, temperature=1.0, repetition_penalty=1.0, last_n_tokens=1)
20
+ response_text = ' '.join(map(str, response))
21
  time.sleep(2)
22
+ corrected_response = correct_words(response_text)
23
  history.append(corrected_response)
24
  yield ' '.join(history)
25
  # Clear the history list after the last response
26
  history = ["Chatbot:"]
 
 
27
 
28
  def chatbot(message, history):
29
  response_generator = generate_response(message)